当路由器只从"home“更改为"aboutpage”或任何其他页面,而是从主页上更改时,我想console.log。
我想不出任何逻辑,所以没有尝试过任何东西。
发布于 2015-11-24 16:10:29
试试像这样的东西
Router.route('/', {
name : 'home',
template : 'home',
title: 'Home'
});
Router.route('/about', {
name : 'about',
template : 'about',
title: 'About'
});
Router.onStop(function(){
Session.set("previousPath",Router.current().route.getName());
});
Router.onBeforeAction(function(){
if(Session.get("previousPath")=="home"){
console.log('something')
}
this.next()
})https://stackoverflow.com/questions/33891913
复制相似问题