当模板中发生事件时,我想在另一个模板中做一些事情。
这是我的代码:
客户端html:
<body> Navigation: {{> navigation}} ======================================================= Body: {{> body}} </body> <template name="navigation"> <input type="button" value="MenuBtn" /> </template> <template name="body"> {{content}} </template>
JavaScript:
Template.navigation.events({
“点击”:功能(e){
// {{body}} 中没有发生任何事情
Template.body.content = 函数(){
// 我想做点什么...比如查询数据库
// 也许,只是一个例子: return peple.find({"name":e.currenTarget.value});
返回“你好”;
};
} });
知道我做错了什么吗?