4

我有一个选项卡面板,里面有几个选项卡。我在选项卡中使用 iconCls 属性为每个选项卡提供一个图像及其标题。我正在使用fam fam fam 16x16 图标,默认选项卡空间是在顶部/底部剪切图像。

我尝试通过更改边距来弄乱图标的类,但这无济于事。根据文档, ext.tab.Tab 组件具有 padding 和 height 属性,但设置这些属性不会在运行时对选项卡产生影响。

Ext.define('AM.view.Tab.Standard', {
    extend: 'Ext.tab.Panel',
    alias: 'widget.TabStandard',

    region: 'center', // a center region is ALWAYS required for border layout
    deferredRender: false,
    activeTab: 0,     // first tab initially active

    initComponent: function() {
      this.items = this.buildItems();  

      this.callParent(arguments);    
    },

    buildItems: function(){
      var items = 
            [
                {
                    padding: 10, // nope :(
                    title: 'Gantt',
                    autoScroll: true,
                    iconCls: 'gantt icon',
                }, 
                {
                    height: 10, // nope :(
                    title: 'Logs',
                    autoScroll: true,
                    iconCls: 'logs icon',
                },
                {
                    title: 'Help',
                    autoScroll: true,
                    iconCls: 'help icon',
                }
            ];
        return items
    },
});

也许我误解了这些属性是如何工作的,但页面上的所有内容看起来都一样。

编辑:当用作手风琴面板时,我似乎对“标题”(带有 +/- 的栏)有同样的问题。

4

1 回答 1

2

您可以使用 tabPanel 上的tabBar属性自定义选项卡面板中的选项卡:

var tabpanel = new Ext.tab.Panel({
   plain: true,
   region: 'center',
   tabBar: {
        defaults: {
            flex: 1, // if you want them to stretch all the way
            height: 20, // set the height
            padding: 6 // set the padding
         },
        dock: 'top'
    }

});

于 2013-06-18T21:19:41.443 回答