0
我正在學習extjs 4.2,在定義一個類和創建對象時,我真的可以在語法和跟蹤方面使用一些幫助。請幫忙嗎?在extjs4.2語法中定義一個類
Ext.define('Student', {
name: 'unnamed',
getName: function() {
alert('Student name is ' + this.name);
},
constructor: function(studentName) {
if (studentName) this.name = studentName;
},
statics: {
staticMethod: function() {
alert("This is static method of student class");
}
}
}
);
//create an object using 'new'
var student1 = new Student('ABC');
student1.getName();
//create an object using Ext.create
var student2 = Ext.create('Student', 'XYZ');
student2.getName();
//create an object using className.create()
var student3 = Student.create('123');
student3.getName();
//call static method by className.staticMethodName()
Student.staticMethod();
你的問題,因爲它代表是不是真的清楚。你在問什麼代碼? –
@EvanTrimboli這不是我的代碼,這是一個示例代碼,我正在尋找一個幫助,如果有可能任何人都可以跟蹤我這個代碼示例。我非常感謝。因爲我對這個概念有一個總體概念,但是我想深入瞭解代碼的細節,所以我會確保我完全理解它。 – mikeb