0

只是想知道是否有人可以让我知道如何使这三个按钮在容器内居中并均匀分布?

Ext.define('rpc.view.home.indexView', {
    extend: 'Ext.Panel',
    alias: 'widget.homeView',
    config: {
       items: [{
           xtype: 'panel',
           layout: { 
               type: 'vbox',
               pack: 'center'
           },
           defaults: {
               xtype: 'button',
               margin: '10 10 0 10'
           },
           items: [{
               text: 'Videos',
               cls: 'x-button-quicknav'
           }, {
               text: 'Events',
               cls: 'x-button-quicknav'
           }, {
               text: 'Sites',
               cls: 'x-button-quicknav'
           }]
        }]
    },
    initialize: function () {
        console.log('rpc.view.home.index ~ initialize');
    }
});
4

1 回答 1

2

搞定了

JS

xtype: 'container',
       layout: {
           type: 'hbox',
           pack: 'center'
       },
       defaults: {
           xtype: 'button',
           ui: 'plain',
           style: 'margin-top: 5px;'
       },
       items: [{
           text: 'Videos',
           cls: 'x-button-rpc',
           flex: 1
       }, {
           xtype: 'container',
           cls: 'x-button-rpc-spacer'
       }, {
           text: 'Events',
           cls: 'x-button-rpc',
           flex: 1
       }, {
           xtype: 'container',
           cls: 'x-button-rpc-spacer'
       }, {
           text: 'Sites',
           cls: 'x-button-rpc',
           flex: 1
       }]

CSS

.x-button-rpc{
    border-radius: 5px;
    border:1px solid #c4c4c4 !important;
    background-color: White !important;
}

.x-button-rpc-spacer{
    display: inline-block;
    width: 5px;
}
于 2011-10-20T18:33:25.313 回答