繁体   English   中英

Sencha Touch:如何使用CSS更改选择字段的颜色?

[英]Sencha Touch: how to change the color of selectfield using css?

在sencha touch2中,我们是否有用于着色selecfield的指定CSS?

到目前为止,我的selectfield代码如下:

{
    xtype: 'selectfield',
    options: [
    {text: 'AI',  value: 'first'},
    {text: 'AK', value: 'second'},
    {text: 'BR',  value: 'third'}
    ]
}

您可以为选择字段使用单独的CSS类。 在“ xtype”值之后使用“ css:'yourclassname'”,并将该类定义为

.yourclassname{ background-color:#000;color:#fff;font:normal 12px Arial;}

所以你的代码将是

              xtype: 'selectfield',
              cls:  'yourclassname',
              options: [
                        {text: 'AI',  value: 'first'},
                        {text: 'AK', value: 'second'},
                        {text: 'BR',  value: 'third'}
                        ]

谢谢

请检查: http : //docs.sencha.com/touch/2-0/#!/guide/theming

使用Sass&Compass是设计应用程序样式的正确方法!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM