日期:2014-05-16  浏览次数:20351 次

ExtJs4 类的声明和创建
1.new 方法创建,主要用来在Extjs4之前的版本.
   function user(){
     //此类创建相当于创建对象的public 属性
     this.name='name1';
     this.password='pwd';
     //此类创建相当于创建私有属性
     var sex='男';
     this.getSex=function(){
       return sex;
      }
     }
    var u=new user();
    alert(u.name);
    alert(u.getSex);
2.extjs推荐的创建对象方法Create方法
    (1)define 创建
     Ext.define("win",
    {extend:'Ext.window.Window',
     width:300,
     hight:300,
     title:'win',
     initComponent:function(){
       this.callParent(arguments);
     }
    })
    (2)create调用 
    Ext.create('win').show();