直接上代码 写在 router js文件
import Vue from 'vue'
import VueRouter from 'vue-router'
import home from '../views/Home.vue'
Vue.use(VueRouter)
/*解决当前导航点击两次回报错*/
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}