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



免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM