Component
在Ext中对常用的UI组件都进行了一系列的封装,而各个组件都具有一些相同的属性或者事件,这些相同的属性被封装起来成为Component类,每个UI组件都继承Component类,可见Ext在面向对象方面有很好的实现。看一下Component中的定义:
- //构造方法,传入config参数
- Ext.Component = function (config){
- config = config || {};
- if (config.initialConfig){...};
- this .initialConfig = config;
- Ext.apply(this , config);
- this .addEvents(...);
- this .getId();
- Ext.ComponentMgr.register(this );
- Ext.Component.superclass.constructor.call(this );
- if ( this .baseAction){
- this .baseAction.addComponent( this );
- }
- //初始化组件
- this .initComponent();