【vue-router】 路由重复跳转 报错解决
问题描述:
使用vue router 时跳转同一路由产生报错

问题解决:
找到 router 下的 index.js 添加代码 (push)
1 const originalPush = VueRouter.prototype.push 2 VueRouter.prototype.push = function push(location) { 3 return originalPush.call(this, location).catch(err => err) 4 }
或 (replace)
1 const originalReplace = VueRouter.prototype.replace 2 VueRouter.prototype.replace = function replace(location) { 3 return originalReplace.call(this, location).catch(err => err) 4 }

浙公网安备 33010602011771号