【发布时间】:2018-07-29 12:53:03
【问题描述】:
这是关于是否可以将 Handlebars lookup 助手与 if 块助手嵌套的问答,如果不能,是否有任何替代解决方案?
下面的示例场景,我们需要检查 'arrayOne' 中的项目是否存在于 'arrayTwo' 中。
{{#each arrayOne}}
{{#if lookup ../arrayTwo @index}}
{{this}} - This arrayOne item is present in arrayTwo
{{else}}
{{this}} - This arrayOne item is NOT present in arrayTwo
{{/if}}
{{/each}}
【问题讨论】:
标签: javascript handlebars.js helper