Ext.define('DynamicButtonText', {
extend: 'Ext.button.Button',
initComponent: function() {
this.text = "ss";
alert("alert in initComponent second")
this.renderTo = Ext.getBody();
},
constructor:function(){
this.text = new Date();
alert("alert in constructor first")
//如果initComponet,constructor同时存在callParent必须写在constructor中
//否则initComponet中的内容不执行
this.callParent();
},
scope:this
});
Ext.onReady(function() {
Ext.create('DynamicButtonText');
});
Extjs4 initComponent 和 constructor 的一点问题
最新推荐文章于 2021-02-24 10:40:59 发布