我刚刚更新到 Meteor 1.0 和 Iron-Router 的最新版本。
无论出于何种原因,当我将数据传递给仅包含单个文档的模板时,它就可以工作。但是当我尝试将多个文档传递给模板时,我得到一个空白屏幕。
//galleryRoute.js
Router.route('/:section', function() {
this.layout('Gallery', {
data: function() {
var data = { photos: photos.find({ path: { $regex: '/'+this.params.section +'/' } }) };
return data;
}
});
});
<template name="Gallery">
<div class="container">
{{#each photos}}
<div class="section-photo" style="background:url({{path}}) no-repeat center center; width:175px; height:175px; background-size:cover;"></div>
{{/each}}
</div>
</template>
想知道是否有人对为什么会这样有任何想法?