zoukankan      html  css  js  c++  java
  • 解决vue-router路由跳转的问题 message: "Navigating to current location ("/homePage") is not allowed",警告的问题

    错误代码:

    1 NavigationDuplicated {_name: "NavigationDuplicated", name: "NavigationDuplicated",
    message: "Navigating to current location ("/index") is not allowed",
    stack: "Error↵ at new NavigationDuplicated (webpack-int…e_modules/element-ui/lib/mixins/emitter.js:29:22)"}
    操作:

    在VUE项目中点击两次路由切换

    原因:
    在路由跳转的时候同一个路由多次添加是不被允许的
    解决方案(两种)

    1.切换版本回3.0版本
    2.在你引了vue-router的js文件里加上如下代码即可

    import Vue from 'vue'  //如果已引用,不需要重复引用
    import Router from 'vue-router'; //如果已引用,不需要重复引用
    Vue.use(Router) //如果已引用,不需要重复引用
    const VueRouterPush = Router.prototype.push 
    Router.prototype.push = function push (to) {
        return VueRouterPush.call(this, to).catch(err => err)
    }
  • 相关阅读:
    css(一)
    Html table
    Html
    jQuery事件和效果
    jQuery基础
    ajax和http状态码
    点击数组选中某一项,存入数组,再次点击删除
    单行两行,多余显示省略号
    git的使用
    产生滚动效果
  • 原文地址:https://www.cnblogs.com/web-record/p/12972939.html
Copyright © 2011-2022 走看看