当前位置: 代码迷 >> JavaScript >> extjs 四 initComponent
  详细解决方案

extjs 四 initComponent

热度:167   发布时间:2012-11-23 22:54:33.0
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>
  相关解决方案