【发布时间】:2012-10-31 01:28:08
【问题描述】:
以下示例将生成玩家姓名列表,其中玩家是来自MongoDB 数据库的数据集。
<template name="players">
{{#each topScorers}}
<div>{{name}}</div>
{{/each}}
</template>
但是,我想连续显示其中四个,打印四个玩家后,我想将行除以<hr />,然后继续。例如,
<template name="players">
{{#each topScorers}}
<div style="float:left;">{{name}}</div>
{{if index%4==0}}
<hr style="clear:both;" />
{{/if}
{{/each}}
</template>
如何在遍历集合时做类似的事情?
【问题讨论】:
标签: meteor handlebars.js