【发布时间】:2021-11-01 01:56:45
【问题描述】:
在 ExtJS 6.2 中,子类是否继承父配置?
它似乎对我不起作用。
Ext.define('test1', {
config: {
test1: {
test1: ''
}
},
constructor(config) {
Ext.apply(this, config);
console.log(config);
},
});
Ext.define('test2', {
extend: 'test1',
config: {
test2: ''
},
constructor(config) {
this.callParent(config);
console.log(this.config);
},
});
Ext.create('test2', {
test1: {
test1: 'test1'
},
test2: 'test2'
});
似乎在父构造函数上config 是undefined!
我希望在父类配置中定义的所有内容也可以在子类中使用。并且可以在创建子类时设置父配置。
【问题讨论】:
标签: javascript inheritance extjs constructor subclass