在路由中添加了相同的路由。Navigating to current location (“/home/index“) is not allowed

Navigating to current location ("/home/index") is not allowed

在src/router.js 里面import Router from 'vue-router’下面写入下面方法即可

/**

  • 重写路由的push方法
    */
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
     
  return routerPush.call(this, location).catch(error=> error)
}

你可能感兴趣的:(vue,vue)