vue 如何获取上一次的 $route 记录
vue 如何获取上一次的 $route 记录
history API
export default {
// name: 'app',
beforeRouteEnter (to, from, next) {
console.log('beforeRouteEnter ✅ to', to, to.path);
console.log('beforeRouteEnter ✅ from', from, from.path);
next();
},
beforeRouteUpdate (to, from, next) {
// react to route changes...
// don't forget to call next()
console.log('beforeRouteUpdate ✅ to', to, to.path);
console.log('beforeRouteUpdate ✅ from', from, from.path);
next();
},
watch: {
$route (to, from) {
console.log('✅ to.path', to, to.path);
console.log('✅ from.path', from, from.path);
},
},
// ...
}
export default {
// name: 'app',
beforeRouteEnter (to, from, next) {
//
},
beforeRouteUpdate (to, from, next) {
// react to route changes...
// don't forget to call next()
},
watch: {
$route (to, from) {
console.log('✅ to.path', to, to.path);
console.log('✅ from.path', from, from.path);
},
},
// ...
}
beforeRouteEnter (to, from, next) {
console.log(to)
console.log(from)
console.log(next)
next();
},
// ...
}
refs
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/14632033.html
未经授权禁止转载,违者必究!