解决vue报错NavigationDuplicated

1. 报错信息

这个报错不影响功能,看着不舒服,就解决掉

2. 解决办法

在main.js添加下面几句话


import Router from 'vue-router'
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

成功解决

猜你喜欢

转载自www.cnblogs.com/wlhappy92/p/NavigationDuplicated.html