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