ext类的创建

来源:互联网 发布:转基因好处数据 编辑:程序博客网 时间:2024/06/14 23:08

近期因工作需要学习了一下ext的使用,ext是一个很强大的js工具。这里简单写一下ext类的创建:

//声明一个类:UserInfoExt.define("UserInfo",{//添加这么写属性:userNo,userName,mobileuserNo:'',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);}}});



0 0
原创粉丝点击