我在一个会徽.js 模板中有以下代码:
each line_items itemController=lineItem
.line_item.row-fluid.popover_link id="line_item_#{unbound id}" click="lineItemSelected" class={selected ordered}
.span8
= product.name
if notSingleItem
span.quantity   X #{quantity}
一个模型:
App.LineItem = DS.Model.extend
quantity: DS.attr 'number'
#this is duplicated for a reason
product_price: DS.attr 'number'
order: DS.belongsTo 'Cluey.Order'
product: DS.belongsTo 'Cluey.Product'
total: Ember.computed ->
@get('quantity') * @get('product_price')
.property('quantity', 'product_price')
notSingleItem: Ember.computed ->
@get('quantity') != 1
.property('quantity')
div_id: Ember.computed ->
"line_item_" + @get('id')
.property()
ordered: DS.attr 'boolean', { defaultValue: false }
should_print: DS.attr 'boolean', { defaultValue: true }
现在,类属性绑定到 LineItem 模型上的属性,该模型具有属性“ordered”,我已将其设置为 true 以进行测试,但它似乎不显示有序类,即使设置了此属性为真。