近期因工作需要学习了一下ext的使用,ext是一个很强大的js工具。这里简单写一下ext类的创建:
//声明一个类:UserInfo
Ext.define("UserInfo",{
//添加这么写属性:userNo,userName,mobile
userNo:'',
userName:'',
mobile:'',
//构造方法
constructor:function(userNo,userName,mobile){
this.userNo=userNo;
this.userName=userName;
this.mobile=mobile;
},
//普通方法,调用方式:(对象.方法名)var user=new UserInfo(); user.show();
show:function(){
alert(this.userNo+" "+this.userName+" "+this.mobile);
},
//静态方法都写在inheritableStatics这里边
//调用方式:(类。方法名) UserInfo.getUser();
inheritableStatics:{
getUser:function(){
alert(this.userNo+" "+this.userName+" "+this.mobile);
}
}
});