我有一个示例应用程序,我使用 itemtpl 将商店数据绑定(bind)到列表,当我动态绑定(bind)时,我对如何更改前两个列表项的颜色和大小没有什么困惑从商店列出的数据。
这是我的示例代码:
Ext.define('Sample.view.SearchResultView', {
extend: 'Ext.Panel',
requires: [
'Ext.List',
'Ext.form.FieldSet',
'Ext.field.Text',
'Ext.Toolbar',
'Ext.TitleBar'
],
alias: "widget.searchresultpage",
config: {
scrollable: true,
items: [
{
xtype: 'list',
layout:'fit',
height:500,
title: 'Search Results',
store: 'MySearchStore',
itemTpl: '<table><td><tr height=10%>{BlockNo}</tr><tr height=90%><p>{ShortDescription}</p></tr></td></table>'
)
}
]
},
});
最佳答案
您需要将 cls
属性添加到列表中,例如:
cls:'myList'
然后将其添加到您的 CSS 文件中:
.myList .x-list-item:nth-child(1),
.myList .x-list-item:nth-child(2) {
color: #CCC;
font-size:14px;
}
希望这有帮助
关于sencha-touch - 如何更改 sencha touch 中列表项的字体大小和颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10892331/