vue3.x Repeatedly click on the route to report an error

Insert picture description here

This error is caused by repeated routing.

Modify in index.js under route folder

Need to rewrite push and replace methods in VueRouter
Insert picture description here

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

const originalReplace = VueRouter.prototype.replace;
VueRouter.prototype.replace = function replace(location) {
    
    
  return originalReplace.call(this, location).catch(err => err);
};

Guess you like

Origin blog.csdn.net/weixin_45773503/article/details/113784748