Ext.onReady(function(){
//子类集成父类
Ext.define("Person",{
config:{
name:"",
age:0,
sex:""
},
say:function(){
Ext.Msg.alert("标题信息","用户提示信息");
},
constructor:function(config){
var me = this ;
me.initConfig(config);
}
});
Ext.define("Student",{
extend:"Person", //继承关系
config:{
},
run:function(){
Ext.Msg.alert("子类标题信息","子类用户提示信息")
},
constructor:function(config){
var me = this ;
me.initConfig(config);
}
})
var stu1 = Ext.create("Person",{
name:"老公",
age:22,
sex:"女"
});
window.alert(stu1.getName())
stu1.say()
var stu2 = Ext.create("Student",{
name:"学生",age:23,sex:"男"
});
window.alert(stu2.age)
stu2.say() //拿到的是父类的say方法
alert("------------");
stu2.run() //拿到的是子类的run方法
});
ExtJs--08--Ext自定义类的继承关系
最新推荐文章于 2018-02-07 14:30:27 发布