【发布时间】:2013-09-28 16:38:51
【问题描述】:
在下划线模板中,如果逻辑如下,我可以这样做:
<% if(type === 'video') { %>
// Something
<% } %>
在车把中我可以做类似的事情吗?试过了,还是不行:
{{#if type === 'video'}}
// Something
{{/if}}
也尝试过使用助手,但仍然没有运气:
Handlebars.registerHelper('isVideo', function(type) {
if(type === 'video') {
return true;
}
return false;
});
{{#if isVideo type}}
// Something
{{/if}}
【问题讨论】: