{xtype: "button",id: "btn1",text: "小按鈕",handler: function () {Ext.MessageBox.alert("提示", "通過handler配置項添加的事件");}}和{xtype: "button",id: "btn2",text: "中按鈕",scale: "medium",listeners: {click: function () {Ext.MessageBox.alert("提示", "通過listeners配置項添加的事件");}}}
2 回答

慕容森
TA貢獻1853條經驗 獲得超18個贊
var TimeBar = Ext.create('Ext.toolbar.Toolbar', {
renderTo : Ext.getBody(),
width : 500,
height : 20,
items : [{
xtype : 'button',
text : 'Sample Text Item',
handler : function () {
alert("handler");
},
listeners : {
click : function (btn) {
alert("click1");
}
}
}
]
});
TimeBar.down('button').addListener('click', function (btn) {
alert('click2');
});
測試下這段代碼你就知道區別了
添加回答
舉報
0/150
提交
取消