我有一个动态配置其项目的视图。这些子项也动态配置自己。
我正在尝试使用 initComponent,但在下面的代码中,仅在 childItem 上存在 initComponent 就会导致错误(“无法读取未定义的属性'长度'”)。
在 childItem 上没有 initComponent,其余的工作。
这有什么问题?有替代方法吗?
Ext.define('myapp.view.MyView', {
extend: 'Ext.container.Container',
initComponent: function () {
var me = this;
var childItem = {
xtype: 'container',
initComponent: function () {
var me = this;
// I want the childItem to do some configuration here.
me.callParent();
}
};
me.items = [
childItem
];
me.callParent();
}
});