我需要list array
在两个 div 中显示一个,前半部分在第一个 DIV 中,后半部分在第二个 DIV 中。请注意,我不想将列表数组拼接成两部分并将它们显示在两个列表中。
这是我的模板,例如
<!-- First half number of items should be displayed in firstHalf div -->
<div id="firstHalf">
{{#each names:i}}
{{firstName}} {{lastName}}
{{/each}}
</div>
<!-- Second half number of items should be displayed in secondHalf div -->
<div id="secondHalf">
{{#each names:i}}
{{firstName}} {{lastName}}
{{/each}}
</div>
例如,如果我有如下数据
var data = [ {
firstName : "Joe", lastName: "Armstrong"
}, {
firstName : "Jose", lastName: "Valim"
}];
它需要呈现如下
<div id="firstHalf">
Joe Armstrong
</div>
<div id="firstHalf">
Jose Valim
</div>
请给我建议以进一步进行。