【发布时间】:2015-12-29 21:30:03
【问题描述】:
假设我有这个数组:
var arr = [
[1,4,6,8,3,9,1],
[2,4,6,7,3,2,7]
];
我想用 mandrill 迭代它 -> 车把 #each 我该怎么做?
到目前为止,我有类似的东西
{{#each arr}}
{{#each this}}
{{this}}
{{/each}}
{{/each}}
上面将输出所需的结果,但是当我在第二个中添加一个条件时,每个 this 值都会更改为一个数组,我假设它需要父级 - 不确定。
{{#each arr}}
{{#each this}}
{{#if @first}}
<div>{{this}} - first</div>
{{else}}
<div>{{this}}</div>
{{/if}}
{{/each}}
{{/each}}
当我使用普通车把时,它工作得非常好。 例如。 http://jsfiddle.net/ccrmwont/2/
我知道这是一个非常具体的问题,但我已经坚持了 2 天了。
【问题讨论】:
标签: javascript handlebars.js mandrill