Extjs-Ext.extend函数的使用

Ext.extend 在 Extjs

예 하나

 함수 자료 (설정) {
   this.name = config.name;
   this.age = config.age;
   this.sex = config.sex;
 }

 함수 기반 (설정) {
  this.identity = config.identity;
  = config.msg을 this.msg;
  this.phone = config.phone;

  base.superclass.constructor.call (이, 구성);
 }

 Ext.extend (베이스,베이스, {
    showMsg : 함수 () {
      window.alert (this.name + ''+ this.age + ''+ this.sex + ''+ this.identity + ''+ this.msg + ''+ this.phone);
    }
 });

  VAR mybase = 새로운 거점 ({
        이름 : '',
        연령 : '',
        성별 : '',
        신분 : '',
        메시지 : '',
        전화 번호 : ''
  });
  mybase.showMsg ();

当 在 这种 情况 下 的 时候

생성자 随后 调用 자료 생성자. 在 EXTJS 中 采用 这种 方式 构造 继承 关系 例如

 EXTUTIL.Observable = 함수 () {VAR 나 =이, E = me.events; 경우 (me.listeners) {me.on (me.listeners), 삭제 me.listeners;} me.events = 전자 | | {} ;}; Ext.Component = 기능 (설정) {/ / ... 此处 省略 Ext.Component.superclass.constructor.call (이); / / ...  } Ext.extend (Ext.Component, Ext.util.Observable, {/ / ...}); 

예 둘 :

 함수 자료 (설정) {
 this.name = config.name;
 this.age = config.age;
 this.sex = config.sex;
  }

  VAR베이스 = Ext.extend (기본, {
    showMsg : 함수 () {
      window.alert (this.name + ''+ this.age + ''+ this.sex + ''+ this.identity + ''+ this.msg + '' + this.phone);
    }
 }

当 在 这种 情况 下 的 时候

 当 VAR mybase = 새로운베이스 (/ ** /); 将会 调用 기본 생성자 函数 

此时 자료 是 기지 的 父 类, 实例 化베이스 时 将会 调用 자료 的 생성자. 在 EXTJS 中 采用 这种 方式 构造 继承 关系 例如

 Ext.Component = 기능 (설정) {

   / / ...
 }

 Ext.BoxComponent = Ext.extend (Ext.Component, {

  / / ...
 });

예 셋

 함수 자료 (설정) {
 this.name = config.name;
 this.age = config.age;
 this.sex = config.sex;
  }

 VAR베이스 = Ext.extend ({
     생성자 : 기능 (설정) {
	    this.identity = config.identity;
	    = config.msg을 this.msg;
	    this.phone = config.phone;

	    base.superclass.constructor.call (이, 구성);
 }
 showMsg : 함수 () {
 window.alert (this.name + ''+ this.age + ''+ this.sex + ''+ this.identity + ''+ this.msg + '' + this.phone);
    }
 }

当 在 这种 情况 下 的 时候

 此时 VAR mybase = 새로운베이스 (/ ** /);. 将会 调用 리터럴 객체 中 的 생성자 即 上图中 的 Ext.extend 中 传入 的 생성자 函数

此时 자료 是 기지 的 父 类, 实例 化베이스 时 将会 调用 리터럴 객체 中 的 생성자. 在 EXTJS 中 采用 这种 方式 构 继承 关系 例如

 Ext.data.DataWriter = 기능 (설정) {
     Ext.apply (이, 구성);
 };

 Ext.data.JsonWriter = Ext.extend (Ext.data.DataWriter, {

     인코딩 : 사실,

     encodeDelete : 거짓,

     생성자 : 기능 (설정) {
         Ext.data.JsonWriter.superclass.constructor.call (이, 구성);
     }

    / / ... 此处 省略
 });

이 포스트를 공유하십시오 :
디그 Google 즐겨찾기 reddit Mixx StumbleUpon 테크노 야후 버즈 DesignFloat 맛있는 BlinkList 감다

'Extjs-Ext.extend 函数 的 使用 "에 대한 응답 없음

답장를 남겨주세요 :

이름 (필수) :
메일 (게시되지 않습니다) (필수) :
웹사이트 :
덧글 (필수) :
XHTML : 당신은 이러한 태그를 사용할 수 있습니다 <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>