多次重复点击跳转路由按钮报错
只需在router下的index.js中写如下代码
const originalReplace = Router.prototype.replace;
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch((err) => err);
};
Router.prototype.replace = function replace(location, onResolve, onReject) {
if (onResolve || onReject) return originalReplace.call(this, location, onResolve, onReject);
return originalReplace.call(this, location).catch((err) => err);
写好后如果使用replace和push也不会重复点击导致爆红