zoukankan      html  css  js  c++  java
  • Vue Avoided redundant navigation to current location Error

    这个报错的根源就是vue-router组件,错误内容翻译一下是: Avoided redundant navigation to current location === 避免冗余导航到当前位置

    这个问题的解决方案就是屏蔽它,就是重写vue-router的push方法,不影响正常使用

    在 Vue.use(VueRouter的时候),前面加上这一句即可

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

    主要的作用就是把err给屏蔽了,不进行输出了,页面看不到这个错误,但是不影响使用

    复制请注明出处,在世界中挣扎的灰太狼
  • 相关阅读:
    作业3.14下
    作业3.14上
    作业3.13 下
    作业 3.13上
    2017.3.10上午
    2017.3.9上午
    2017.3.23-morning
    2017.3.22-morning
    2017.3.21-afternoon
    2017.3.21-morning
  • 原文地址:https://www.cnblogs.com/XingXiaoMeng/p/13188856.html
Copyright © 2011-2022 走看看