Explorar o código

NavigationDuplicated error

NavigationDuplicated: Avoided redundant navigation to current location
![](https://img-blog.csdnimg.cn/20200901093646588.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MjQwMjg0NQ==,size_16,color_FFFFFF,t_70)
xiaowei %!s(int64=4) %!d(string=hai) anos
pai
achega
2f6eb83ca9
Modificáronse 1 ficheiros con 8 adicións e 1 borrados
  1. 8 1
      web/src/router/index.js

+ 8 - 1
web/src/router/index.js

@@ -3,6 +3,13 @@ import Router from 'vue-router'
 
 Vue.use(Router)
 
+//获取原型对象上的push函数
+const originalPush = Router.prototype.push
+//修改原型对象中的push方法
+Router.prototype.push = function push(location) {
+   return originalPush.call(this, location).catch(err => err)
+}
+
 const baseRouters = [{
         path: '/',
         redirect: '/login'
@@ -23,4 +30,4 @@ const createRouter = () => new Router({
 
 const router = createRouter()
 
-export default router
+export default router