我有一个混音:
export default Ember.Mixin.create({
queryParams: ['abc', 'def', 'ghi']
});
和控制器:
import SampleMixin from 'app/mixins/sample-mixin';
export Ember.ObjectController.extend(SampleMixin, {
queryParams: function () {
var mixinQParams = this.getMixinParams();
mixinQParams.append('xyz');
return mixinQParams;
}.property()
});
我的问题是我们如何获取mixins的queryParam,以便我们可以编辑它或添加更多值,即使用上面的getMixinParams()来获取get mixin属性。
答案 0 :(得分:2)
您正在寻找连锁属性:
export default Ember.Mixin.create({
queryParams: ['abc', 'def', 'ghi'],
concatenatedProperties: ['queryParams']
});
然后
import SampleMixin from 'app/mixins/sample-mixin';
export Ember.ObjectController.extend(SampleMixin, {
queryParams: ['xyz']
});
现在
<< this.get('queryParams')
>> ['abc', 'def', 'ghi', 'xyz']