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)
}

 

你可能感兴趣的:(VUE.JS)