创建 ExtJs 扩展类

Kli*_*Max 4 javascript extjs extjs3

我尝试像 sencha示例中那样扩展 Button 。
我确实摆弄
并得到错误:TypeError: this.addEvents is not a function : 'statesave'
怎么了?

sra*_*sra 5

您只是忘了打电话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()});
Run Code Online (Sandbox Code Playgroud)