to initComponent() or not to initComponent()

https://stackoverflow.com/questions/14492179/to-initcomponent-or-not-to-initcomponent

 

Config Objects on the Prototype

http://skirtlesden.com/articles/config-objects-on-the-prototype

 

Best Practices concerning initComponent() in Ext.define()

https://stackoverflow.com/questions/6871594/best-practices-concerning-initcomponent-in-ext-define

 

总结就是:

引用类型的配置或需要动态创建的配置需要放在initComponent中建立。

Ext.define的创建实例机制应该是从定义的类中复制属性值给实例,配置中有引用类型的话自然是多个实例都共享了。

另外define自定义类中的子控件都要用xtype来配置,不能用Ext.create,create了自然就是所有实例共享,会出现混乱。

 

posted @ 2018-12-18 14:20  老豆芽  阅读(128)  评论(0)    收藏  举报