Vue-router报错 Avoided redundant navigation to current... 解决问题

    技术2023-07-07  74

    在vue项目中路由跳转过程中浏览器会报Avoided redundant navigation to current location 这个错误, 解决方法:在路由文件里添加这一句可解决报错问题

    const originalPush = VueRouter.prototype.push VueRouter.prototype.push = function push(location) { return originalPush.call(this, location).catch(err => err) }
    Processed: 0.009, SQL: 9