initComponent
场景:extjs 四 initComponent
extjs 4 initComponent?
extjs 4 initComponent?
initComponent 和constructor 的参数问题?
initComponent 可以取得constructor 中的参数吗?怎样取得? 2012-3-15
例证:
<script type="text/javascript"> // Ext.define('Desktop',{ extend:'Ext.panel.Panel', app:null, initComponent:function(){ alert('app='+this.app); //注意此处 this.app 是 App 而不是null } }); // Ext.define('App',{ constructor:function(){ var me=this; desktopCfg=me.getDesktopConfig(); new Desktop(desktopCfg); }, getDesktopConfig:function(){ var me=this, cfg={ app:me } return cfg; } }); Ext.onReady(function(){ new App(); }) </script>