【发布时间】:2017-03-23 20:42:25
【问题描述】:
我正在使用 Foundation for Sites,它使用 Panini and Handlebars 进行 JS 模板。我需要一个包含 js 变量的 {{#ifequal}} 语句,以便我可以将 URL 参数与 JSON 进行比较
我现在拥有的:
{{#ifequal "Canada" this.destination}}
//do the thing
{{/ifequal}}
我需要的是这样的:
{{#ifequal <script>document.write(destId)</script> this.destination}}
//do the thing
{{/ifequal}}
js var "destId" 是在页面前面从 URL 参数中拉出时分配的,但我当然不能在把手中包含脚本。如果有办法将 URL 参数直接传递到也可以工作的车把。
【问题讨论】:
标签: handlebars.js zurb-foundation