button可以通过handler来运行相关代码当用户单击button后,或者使用listeners来处理其他事件,例如鼠标移动
例一:
Ext.create('Ext.Button', {
text: 'Click me',
renderTo: Ext.getBody(),
handler: function() {
alert('You clicked the button!');
}
});
scale属性指定button的外观大小,有'small''medium''large'三种属性Ext.create('Ext.Container',{ renderTo:Ext.getBody(), items:[ { xtype:'button', text:'My', scale:'large' } ] });
button也可以当做是菜单来用
Ext.create('Ext.Container',{ renderTo:Ext.getBody(), items:[ { xtype:'button', text:'My', scale:'large', menu:[ {text:'1'}, {text:'2'}, {text:'3'} ] } ] });
listeners: { click:function() { this.setText('click'); }, mouseover:function() { alert('hello'); } }
listeners有多个事件:
- click
- toggle
- mouseover
- mouseout
- mouseshow
- menuhide
- menutriggerover
- menutriggerout