我想弄清楚我的計算屬性如何識別我的關係是否設置。創建一個計算布爾使用關係字段Ember
Project = Model.extend({
participantes: hasMany('author')
...
我需要改變我的CSS基礎,如果有一個作者。
{{my-component project=project}}
//---------- my-component.js
export default Ember.Component.extend({
classNameBindings: ['hasParticipante'],
hasParticipante = Ember.computed('project.participantes', function(){
//the code I need gonna here
})});
箭頭函數不是普通函數的縮寫,他們改變'this'綁定。您無法將箭頭函數傳遞給'Ember.computed'。 – locks
你說得對。我沒有複製我的真實代碼。 – heat