You can break it up into groups of 2 inside a helper using underscore's map and compactTemplate.hello.helpers({ groups() { // var data = myData.find().fetch(); var data = [ { category : "Cat1"}, { category : "Cat2"}, { category : "Cat3"}, { category : "Cat4"}, { category : "Cat5"}, { category : "Cat6"}]; return _.chain(data).map(function(item, index){ return (index % 2) ? false : data.slice(index, index + 2); }).compact().value(); },});然后,在您的模板中,您可以使用嵌套的 #each in 来遍历组Then, in your template you can use a nested #each in to loop through groups<template name="hello"> <ul> {{#each group in groups}} <li class="col-md-2"> <ul> {{#each category in group}} <li>{{category.category}}</li> {{/each}} </ul> </li> {{/each}} </ul> </template> 这篇关于分组和显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-01 12:59