EXTJS7 構造函數constructor中的config

小編:管理員 375閱讀 2022.09.07

extjs組件的構造函數可以獲得兩個config變量

constructor: function (config) {
    this.config
    this.callParent([config]);
},
復制
  • 傳入參數config:實例化組件時傳入的配置參數
  • 成員變量this.config: 組件類定義中的配置值 例如:
Ext.define('mybasecomp',{
  config: {myBaseProp: 'defaultBasePropValue'},
  constructor: function(config){
    config; // 值為 {myProp: 'propValue'}
    this.config; // 值為 {myProp: 'defaultPropValue', myBaseProp: 'basePropValue', __proto__: {myBaseProp: 'defaultBasePropValue'}}
	...
  }
});
Ext.define('mycomp',{
  extend: 'mybasecomp',
  myBaseProp: 'basePropValue'
  config: {myProp: 'defaultPropValue'},
  constructor: function(config){
    config; // 值為 {myProp: 'propValue'}
    this.config; // 值為 {myProp: 'defaultPropValue', myBaseProp: 'basePropValue', __proto__: {myBaseProp: 'defaultBasePropValue'}}
	...
  }
});
Ext.create('mycomp',{
  myProp: 'propValue'
});
復制
關聯標簽:
亚洲国产欧美图片,亚洲aⅴ在线av,日韩亚洲综合图片视频,日本av精品在线中文