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面向对象