VUE防止路由重复点击报错

在router/index.js中添加如下代码

import Vue from 'vue'

import Router from 'vue-router'

Vue.use(Router)

// 防止路由重复点击报错

const originalPush = Router.prototype.push

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

猜你喜欢

转载自blog.csdn.net/yangwqi/article/details/112979528