报错:
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/userlist?row=%5Bobject%20Object%5D".
createRouterError vue-router.esm.js:2065
createNavigationDuplicatedError vue-router.esm.js:2035
confirmTransition vue-router.esm.js:2328
transitionTo vue-router.esm.js:2260
push vue-router.esm.js:2710
push vue-router.esm.js:3026
push vue-router.esm.js:3025
handleEdit UserList.vue:119
click UserList.vue:115
VueJS 4
handleClick element-ui.common.js:9417
VueJS 3
vue-router.esm.js:2065
transitionTo vue-router.esm.js:2280
abort vue-router.esm.js:2317
confirmTransition vue-router.esm.js:2328
transitionTo vue-router.esm.js:2260
push vue-router.esm.js:2710
push vue-router.esm.js:3026
push vue-router.esm.js:3025
handleEdit UserList.vue:119
handleEdit self-hosted:1175
click UserList.vue:115
VueJS 4
handleClick element-ui.common.js:9417
handleClick self-hosted:1175
VueJS 3
截图:
问题描述:
报错大致意思就是:避免导航重复
解决:
在router里加上这么一句话:
/* 解决导航重复问题 */
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
return originalPush.call(this, location).catch(err => err)
}
截图: