您的位置:首页 > Web前端 > JavaScript

『ExtJS』01 001. ExtJS 4 类的定义

2012-11-23 16:06 169 查看
ExtJS 4 类的定义

类的定义与类方法的调用

样例代码3Ext.define('Cookbook.Vehicle', {
Manufacturer : 'Aston Martin',
Model : 'Vanquish',

getManufacturer : function() {
return this.Manufacturer;
},
setManufacturer : function() {
this.Manufacturer = value;
},
resetManufacturer : function() {
this.setManufacturer('Aston Martin');
},
applyManufacturer : function(manufacturer) {
// perform some action to apply the value(e.g. update a DOM element
return manufacturer;
},
getModel : function() {
return this.Model;
},
setModel : function(value) {
this.Model = value;
},
resetModel : function() {
this.setModel('Vanquish');
},
applyModel : function(model) {
// perform some action to apply the value (e.g. update a DOM element)
return model;
},
getDetails : function() {
alert(' ... ')
}
});


总结

使用Ext.define()方法定义类主要有三个部分:类配置部分,类方法,定义回调方法。
ExtJS中,定义、实例化一个类时,直接使用字符串的命名的形式。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: