使用 Meteor 和 Iron Router 路由到另一个页面后如何重新加载页面
How can I reload a page after routing to another page using Meteor and Iron Router
我正在使用 Meteor js 开发一个演示网站。我想点击一个按钮,直接转到另一个页面。但在那之后,新页面需要自动重新加载。逻辑是这样的:
Template.reload.events({
'click #mybutton': function(){
var index = ...//randomly generate an index;
Router.go('/'+index);//I have Router.route("/:index" ) in router.js
//I want to reload the new page after the going to a new page
}
我想我可以在某个地方使用 document.location.reload(true);
,但我不确定该放在哪里。有什么建议么?谢谢
请试试这个
您可以使用 Location.reload() 方法。
Template.reload.events({
'click #mybutton': function(){
var index = ...//randomly generate an index;
Router.go('/'+index);//I have Router.route("/:index" ) in router.js
document.location.reload(true);
}
我正在使用 Meteor js 开发一个演示网站。我想点击一个按钮,直接转到另一个页面。但在那之后,新页面需要自动重新加载。逻辑是这样的:
Template.reload.events({
'click #mybutton': function(){
var index = ...//randomly generate an index;
Router.go('/'+index);//I have Router.route("/:index" ) in router.js
//I want to reload the new page after the going to a new page
}
我想我可以在某个地方使用 document.location.reload(true);
,但我不确定该放在哪里。有什么建议么?谢谢
请试试这个 您可以使用 Location.reload() 方法。
Template.reload.events({
'click #mybutton': function(){
var index = ...//randomly generate an index;
Router.go('/'+index);//I have Router.route("/:index" ) in router.js
document.location.reload(true);
}