ExtJs面向对象
本章任务
1.ExtJs面向对象
/**
* 命名空间
*/
Ext.namespace("com.aptech.fy");
fy = com.aptech.fy;
/**
* 页面加载
*/
Ext.onReady(function(){
//Ext.Msg.alert("hello world!!!!!");
//alert("hello world!!!!!");
/**
* 类
*/
fy.people = function(obj){
Ext.apply(this,obj);
//私有属性
var name = "";
var sex = "";
//公有属性
this.location = "sz";
this.language = "china";
//封装
this.getName = function(){
return name;
};
this.setName = function(obj){
name = obj;
};
}
/**
* 静态
*/
fy.people.begin = function(){
alert("我是静态的!!!");
}
/**
* 继承
*/
fy.student = Ext.extend(fy.people,{
/**
* 构造器
*/
constructor:function(){
fy.student.superclass.constructor.apply(this,arguments);
},
study:function(obj){
//alert(obj.name);
}
})
fy.people.begin();
});
本章目标
1. 理解ExtJs面向对象
本文介绍了如何使用 ExtJS 实现面向对象编程,包括命名空间定义、类的创建及封装、静态方法使用、继承及构造器重写等关键概念。通过具体代码示例展示了 ExtJS 的 OOP 特性。
140

被折叠的 条评论
为什么被折叠?



