首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

ExtJs 四 类的定义方式改进

2012-09-01 
ExtJs 4 类的定义方式改进Extjs 3 中是这样定义类的:?Ext.define(MyApp.LoginWindow, {extend: Ext.Win

ExtJs 4 类的定义方式改进

Extjs 3 中是这样定义类的:

?

Ext.define('MyApp.LoginWindow', {    extend: 'Ext.Window',     title: 'Log in',     initComponent: function() {        Ext.apply(this, {            items: [                //as above            ]        });         MyApp.LoginWindow.superclass.initComponent.apply(this, arguments);    }}); 

?这样做有两个好处:

?

不会出现忘记定出 MyApp namespace 的情况如果 Ext.Window 的定义位置比 MyApp.LoginWindow 晚,使用 4 的方式可以延时定义 LoginWindow 知道找到了 Ext.Window 的定义

热点排行