2012-10-12 11 views

回答

3

您可以使用CSS來改變填充

Ext.create('Ext.Button', { 
    text: 'Click me', 
    renderTo: Ext.getBody(), 
    cls: 'my-btn' 
}); 

/* The button wrapper */ 
.my-btn.x-btn { 
    padding: 5px; 
} 

/** or the button itself */ 
.my-btn.x-btn button {...} 

或者你可以用JS

Ext.create('Ext.Button', { 
    text: 'Click me', 
    renderTo: Ext.getBody(), 
    padding: 10, 
    handler: function() { 
     alert('You clicked the button!'); 
    } 
}); 
+0

本事出於好奇:可自定義的CSS類是應用於任何組件? – Christoph

+0

@Christoph是的。見http://docs.sencha.com/ext-js/4-1/#!/api/Ext.AbstractComponent-cfg-cls –

+0

好。謝謝 :) – Christoph