在流星中,我可以像这样设置各种模板助手:
Template.story.title = function () {
return "title";
};
<template name="story">
<h3>{{title}}</h3>
<p>{{description}}</p>
</template>
这很好,但是,如果我有很多变量,我不想单独设置它们,我想将上下文传递给主模板。
我怎么做?
Template.story.data = function () {
return {title:"title", description:"desc"};
};
<template name="story">
<h3>{{title}}</h3>
<p>{{description}}</p>
</template>
那是行不通的。谢谢