2016-04-21 44 views

回答

0

創建的對象與ExtJS的,你可以做這樣的事情:

Ext.define('Computer', { 
    statics: { 
     factory: function(brand) { 
      // 'this' in static methods refer to the class itself 
      return new this(brand); 
     } 
    }, 

    constructor: function() { ... } 
}); 

var dellComputer = Computer.factory('Dell'); 

「工廠」的方法是靜態並可以在沒有計算機實例的情況下使用。

相關問題