解决vue路由跳转连续点击报错问题

在router的index.js里面加入以下代码

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
  • 注意VueRouter名,与import VueRouter from 'vue-router'引入的名保持一致

猜你喜欢

转载自blog.csdn.net/ZiChen_Jiang/article/details/107184134
今日推荐