注册Helper:
Handlebars.registerHelper('ifNotEffective', function(value, options) {
if(value != 0) {
return options.fn(this);
} else {
return options.inverse(this);
}
});
使用:
{{#ifNotEffective isEffective}}
<a {{#unless nodes}}class="J_menuItems" οnclick="return false" href="javascript:void(0)" style="color:lightgrey" {{/unless}}href="{{href}}"data-index="0">
{{text}}
{{#if nodes}}
<span class="fa fa-caret-right ui-icon-right"></span>
{{/if}}
</a>
{{else}}
<a {{#unless nodes}}class="J_menuItem"{{/unless}}href="{{href}}"data-index="0">
{{text}}
{{#if nodes}}
<span class="fa fa-caret-right ui-icon-right"></span>
{{/if}}
</a>
{{/ifNotEffective}}