如何在ST2中设置标题栏中文本的字体大小?



如何设置ST2中标题栏文字的字体大小?

我已经尝试了'style'属性,但它也会影响工具栏中按钮的文本,如果字体大小较小,它们会呈现较小。我只想在工具栏中设置标题的文本,而不是包括按钮在内的所有内容。

有谁知道这是怎么做到的吗?

为什么不直接:

title: '<div style="font-size: 30px; color: orange;">Title</div>',

工作演示

Titlebar有一个名为styleHtmlCls的配置,它可以让你定义一个应用于内容的类。您需要将styleHtmlContent设置为true

可能不是最好的方法,但你可以试试:

Ext.define('MyApp.view.MyPanel', {
    extend: 'Ext.Panel',
    config: {
        items: [
            {
                xtype: 'titlebar',
                docked: 'top',
                title: 'Cool Story Bro',
                items: [
                    {
                        xtype: 'button',
                        text: 'MyButton'
                    },
                    {
                        xtype: 'button',
                        align: 'right',
                        text: 'MyButton1'
                    }
                ],
                listeners: [
                    {
                        fn: function(element, options) {
                            Ext.getCmp(element.id).titleComponent.innerElement.dom.style.color = 'red';
                            Ext.getCmp(element.id).titleComponent.innerElement.dom.style.fontSize = '30px';
                            Ext.getCmp(element.id).titleComponent.innerElement.dom.style.fontStyle = 'italic';
                        },
                        event: 'painted'
                    }
                ]
            }
        ]
    }
});

演示:http://www.senchafiddle.com/# m3ilK # ArrdD

最新更新