读书人

extjs 四 initComponent

发布时间: 2012-11-23 22:54:33 作者: rapoo

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>

读书人网 >JavaScript

热点推荐