可能缺少一些简单的东西,但是如何根据对对象的操作在 Handlebars 中指定条件?
想做类似的事情
{{#hasDiscount this}}
  <tr>
    <td>Discount</td>
    <td>{{formatPrice this.Discount}}</td>
  </tr>
{{/hasDiscount}}
与助手一起
Handlebars.registerHelper 'hasDiscount', (cart) ->
  :runBlock: if cart.Discount > 0
不知道如何告诉它运行该块。
感谢您的任何意见。