需要分别对不同的路径,进行不同的操作
做路由监听变化即可
js
watch : {
'$route' (to, from) {
// from 对象中要 router 来源信息.
// do your want
}
}
watch : {
'$route' (to, from) {
// from 对象中要 router 来源信息.
// do your want
}
}
js
beforeRouteEnter (to, from, next) {
console.log(to)
console.log(from)
console.log(next)
next(); // 需要添加next(),才能进行下一步
}
beforeRouteEnter (to, from, next) {
console.log(to)
console.log(from)
console.log(next)
next(); // 需要添加next(),才能进行下一步
}