【发布时间】:2017-08-22 01:48:05
【问题描述】:
我正在尝试将样式应用于 ViewModel 中的绑定公式。
我的 ViewModel 是:
viewModel: {
formulas: {
firstTestStoreRecord: {
bind: '{testStore}',
get: function(testStore) {
return testStore.getAt(0);
}
}
},
stores:{
testStore: {
//fields: [{ name: 'test', type: 'string' }],
data: [{
test: 'Foo',
style: {
'font-size': '22px',
'color':'red',
}
}]
}
}
},
我对绑定公式的参考是:
items: [{
xtype: 'form',
title: 'Bound form',
flex: 1,
items: [{
xtype: 'label',
bind: {
html: '<b>{firstTestStoreRecord.test}</b>',
bodyStyle: '{style}'
}
}]
}]
这是我正在尝试的小提琴:Bind store from a ViewModel to an xtype label with style。我正在尝试更改 html 中的字体样式,但它不起作用。我以此作为参考:How-to-bind-to-style-and-or-html-property
【问题讨论】:
-
我看到的第一件事是你的html绑定到
firstTestStoreRecord.test,但是你的样式NOT绑定到firstTestStoreRecord.style。 -
另外,标签没有
bodyStyle,也没有style配置。
标签: html extjs data-binding