首页 > 其他 > 详细

Vue使用路由报错

时间:2020-12-25 21:23:40      阅读:41      评论:0      收藏:0      [点我收藏+]

报错:

  Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/user/zhangsan".

  技术分享图片

 

解决办法:

  看自己是选用了什么样的跳转方式:两种跳转方式push和replace

  push:

Vue.use(Router)

const originalPush1 = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush1.call(this, location).catch(err => err)
}

  replace:

Vue.use(Router)
const originalReplace2 = Router.prototype.replace;
Router.prototype.replace = function replace(location) {
return originalReplace2.call(this, location).catch(err => err);
};


Vue使用路由报错

原文:https://www.cnblogs.com/lucky-jun/p/14190579.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!