classes system in sencha touch

//http://www.sencha.com/learn/sencha-class-system
var Person = new Ext.Class({
name: 'Mr. Unknown',
walk: function(steps) {
alert(this.name + ' is walking ' + steps + ' steps');
}
}); //http://docs.sencha.com/touch/2.2.1/#!/guide/class_system
//Ext.ns('My.sample');//define the namespace
Ext.define('Animal', { requires: [
'Ext.MessageBox'
], constructor: function(config) {
this.initConfig(config);
}, config: {
name: 'default name',
gender:'male'
}, speak: function() {
//alert('grunt');
Ext.Msg.alert(this.getName(), "Speaks...");
}, statics : { static1 :function(){
console.log('static fun1, called by Animail.static1');
}
}
}); console.log('launching...');
Animal.static1();
var ani=Ext.create('Animal',{name:'abc'});
console.log(ani.getName());
ani._name='zhaoyao';
console.log(ani.getName());
console.log(ani._gender);
ani.speak();
上一篇:阿里社招Java面试题总结——面试官分享


下一篇:fir.im Weekly - 可能是 2017 最好的 Swift 学习资源