多次点击同一路由跳转,控制台报错问题

用的vue2,在点击按钮跳转路径的时候发现,多次点击同一路径的按钮的时候,控制台会报错

需要在router.js文件中!!!一定注意不是在main.js中添加这些代码

const originalPush = VueRouter.prototype.push

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

Vue.use(VueRouter)

猜你喜欢

转载自blog.csdn.net/lilikk1314/article/details/120655325