2017-10-12 76 views
1

我有以下對象:偵聽新添加的屬性對計算功能

{ 
types: ["Type A", "Type B", "Type C"], 
colours: ["Red", "Blue", "Black"] 
} 

我作爲參數發送到組件

export default Ember.component.extend({ 
    tableContent: function(){ 
    const keys = Object.keys(this.get('config')); 
    if (keys.length > 1){ 
    let array = []; 
    keys.shift(); 
    keys.forEach((element) => { 
    array.pushObject({name: element}); 
    }); 
    return array; 
    } 
}.property('config') 

我希望能夠偵聽更改時創建一個新的補充。例如:

{ 
types: ["Type A", "Type B", "Type C"], 
colours: ["Red", "Blue", "Black", "Yellow"]. 
lang: ["en","fr","es"] 
} 

我試過使用.property('config。@ each'),但它不會工作。

任何想法? 謝謝。

回答