我是流星的新手,我想知道为什么当我开始将这些文件放在我的 /client/template 目录中时 myTemplate.helper 没有呈现其假定的输出。这些是以下文件:
/客户/模板/body.html:
<body>
<div class="row">
<div class="col-xs-12">
<div class="list-group">
{{#each projects}}
{{> projectList}}
{{/each}}
</div>
</div>
</div>
</body>
/client/template/body.js:
Project = new Mongo.Collection("project");
if (Meteor.isClient) {
Template.body.helpers({
projects: function(){
var projects = Project.find({});
return projects;
}
});
};
/client/template/templates.html:
<template name="projectList">
<a href="#" id="{{id}}" class="list-group-item {{#if active}} active {{/if}}">
{{name}}
<i class="glyphicon glyphicon-trash pull-right del"></i>
</a>
</template>
但是,当我将 body.html 和 body.js 放在根/
目录时,它会正确呈现输出。