Vue 路由跳转报错:NavigationDuplicated: Avoided redundant navigation to current location

含义

不要重复导航到当前位置。

解决办法

在 router.js 或者 /router/index.js 路由文件中,添加如下代码:

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

如下图:

每天学习一点点,每天进步。

posted @ 2021-03-22 16:41  爱吃西瓜的番茄酱  阅读(555)  评论(0编辑  收藏  举报