多次点击路由跳转按钮,在控制台会报错,虽然对项目的运行没有什么影响,但总会觉得代码写的不够好
解决办法:在导入路由的文件中加入下面代码
/**
* 修改首页面路由重复点击报错
*/
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err);
};