Ember.js 如何从余烬数据集合中提取特定值?
下面的代码是我当前的解决方案Ember.js 如何从余烬数据集合中提取特定值?,ember.js,Ember.js,下面的代码是我当前的解决方案 tagsValue: Ember.computed('tags.@each', { get() { const out = []; this.get('tags').forEach((tag) => { out.push(tag.get('value')); }); return out; } }), 有更好的方法吗?试试下面的代码 tagsValue: Ember.
tagsValue: Ember.computed('tags.@each', {
get() {
const out = [];
this.get('tags').forEach((tag) => {
out.push(tag.get('value'));
});
return out;
}
}),
有更好的方法吗?试试下面的代码
tagsValue: Ember.computed('tags.@each', {
get() {
return this.get('tags').mapBy('value');
}
}),