xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

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, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2021-04-08 14:25  xgqfrms  阅读(830)  评论(3编辑  收藏  举报