2017-10-12 41 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'),但它不会工作。

任何想法? 谢谢。

回答