在meteor中不能返回到默认模板
Cannot go back to default templates in meteor
所以我在一个html页面中使用4个模板。模板1是默认模板,当你进入这个html页面时,你应该看到它。
然而,当我浏览其他模板和其他html页面后,当我回到这个页面时,它会显示我离开该页面时所处的模板,而不是默认模板。
HTML:<template name = "Page1">
<div class = "events">
{{>Template.dynamic template=selector}}
</div>
</template>
<template name = "template1">...</template>
<template name = "template2">...</template>
<template name = "template3">...</template>
<template name = "template4">...</template>
Javascript: if(Meteor.isClient) {
Session.setDefault("selector","eventDetailPage");
Template.showEvent.helpers ({
selector: function () {
return Session.get("selector");
}
});
Template.showEvent.events ({
'click #temp2': function(){
Session.set('selector’,'template2')
}
});
...template 2, 3, 4...
}
Session.setDefault("selector","eventDetailPage");
可能是您用来跟踪哪些template1/template2/…呈现。它只在web浏览器初始化时被调用。
如果您想在返回page1时返回默认页面,那么您将需要这样的设置。
Template.Page1.onRendered(function() {
`Session.set("selector","template1");`
})
相关文章:
- JQuery BlockUI鼠标加载光标没有't在Google Chrome中返回默认值
- 如何从Map返回默认值
- 如何使用链式函数和默认函数正确返回
- javascript:input字段在隐藏时返回默认值
- 将javascript(jQuery)对象属性返回到默认状态
- 为什么我的模型中的默认属性返回未定义
- AJAX Solr 返回默认通配符 *:*,而不是我查询的内容
- 如果文本框为空,则将其返回到默认值
- PHP 设置默认值以从 ajax 页面返回记录
- 火狐返回假;(防止默认();)和 window.location.reload();一起
- javascript对象中的默认函数返回
- 我想在点击事件发生后将光标更改为等待,然后返回默认值
- 如何在jquery中将select框的默认返回值设置为null
- 如果未返回任何值,则保持货币格式的JQgrid单元格为空,不带默认值
- 从一个模型到另一个模型的引用var在Backbone中返回默认值
- JavaScript返回默认值
- 默认情况下返回一个属性值
- 更改后返回默认复选框
- 如何防止亚马逊Fire TV HTML5 web应用程序中的默认返回行为
- 是否可以使用浏览器的默认返回按钮使用jquery进行重定向?