可能缺少一些簡單的東西,但是如何根據對象的操作在Handlebars中指定條件?Handlebars中的自定義條件
希望做類似
{{#hasDiscount this}}
<tr>
<td>Discount</td>
<td>{{formatPrice this.Discount}}</td>
</tr>
{{/hasDiscount}}
隨着沿
Handlebars.registerHelper 'hasDiscount', (cart) ->
:runBlock: if cart.Discount > 0
不知道如何告訴它運行的多個行的幫手。
感謝您的任何意見。
這很簡單,優雅的幫手。 – Quickredfox 2012-09-12 18:55:25