An error occurred when the routing redirected multiple times to the unified page

When jumping is clicked multiple times, the following error may occur

 Mainly because the routes of multiple jumps are repeated

Solution: Add such a line of code to the router configuration js file

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

In this way, no matter how many times you jump, you will not report an error.

Guess you like

Origin blog.csdn.net/m0_70547044/article/details/128178677