我尝试像在sencha example中一样扩展Button
我做fiddle
并得到错误:TypeError: this.addEvents is not a function : 'statesave'
。
怎么了?
答案 0 :(得分:4)
您忘记致电new
,而您输入的拼写错误JSFiddle
PuffButton = Ext.extend(Ext.Button,{
constructor: function(config){
PuffButton.superclass.constructor.apply(this,arguments);
console.log("111111");
this.on('click',function(){this.el.puff();},this);
}
});
var puff = new PuffButton({text: 'Puff', renderTo:Ext.getBody()});
答案 1 :(得分:2)
使用define代替。不推荐使用Extend方法。
Ext.define('Grid', {
extend: 'Ext.grid.Panel',
constructor: function (config) {
this.callParent(arguments);
}
});