javascript - 更改xtype菜单extjs的字体颜色和样式

标签 javascript extjs extjs4

如何更改用户的字体颜色和样式,如下图所示?我希望它像右侧的白色字体一样。这是我的代码

{
        text: 'Users',
        iconCls: 'user',
        menu: {
            xtype: 'menu',
            bodyStyle:'background-color:white !important;',
            plain: true,
            items: {
                xtype: 'buttongroup',
                columns: 1,
                defaults: {
                    xtype: 'button',
                    scale: 'large',
                    iconAlign: 'left'
                },
                items: [
                {
                    text: 'Settings',
                    width: 130
                },{
                    text: 'Notifications',
                    width: 130
                },{
                    text: 'Log Out',
                    width: 130
                }]
            }
      }
},
{
        xtype: 'label',
        id: 'h_usr',
        margin: '0 5 0 5',
        hidden: true,
        style: {
            'color':'white',
            'style': 'Helvetica',
            'font-size': '15px'
        },
        html: 'Logged in as <b>admin</b>'
    }

enter image description here

最佳答案

只需更新 html 配置属性以包含颜色:

html: 'Logged in as <span style="font-weight: bold; color: green;">admin</span>'

这将使用户名变成绿色等。

关于javascript - 更改xtype菜单extjs的字体颜色和样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21018159/

相关文章:

javascript - ExtJS 自动调整大小选项卡面板

EXTJS4:如何设置 xtype :'textfield' 的字段标签宽度

javascript - ExtJS 通过关联自动填充模型属性

javascript - 在 colorbox 中向 googlemap 添加功能

javascript - 将 JavaScript 与 JQuery 一起包含的问题

javascript - Python读取http : html page as seen in browser - with javascripts results

rest - 如何在 ExtJs 4 中获取 REST 响应消息?

javascript - 使用 Python 从站点(部分用 Javascript 编写)下载文件

javascript - sailsjs + ext-direct (sencha extjs)

javascript - ExtJS4可编辑网格获取选定行返回空