报错:NavigationDuplicated: Avoided redundant navigation to current location(跳转了重复路由)

跳转重复路由导致的报错

Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/login"

解决方案:
在 router 文件下,添加如下代码

Vue.use(Router)

//*******以下为添加内容*******
const VueRouterPush = Router.prototype.push
Router.prototype.push = function push (to) {
  return VueRouterPush.call(this, to).catch(err => err)
}
//******以上为添加内容*********

export default new Router({

你可能感兴趣的:(Vue,vue,Duplicated,redundant,navigation,跳转重复路由)