vue进入相同路由,避免重复路由报错

225 阅读1分钟

路由报错信息:Avoided redundant navigation to current location 

import Vue from 'vue' 
import VueRouter from 'vue-router'

 Vue.use(VueRouter)

//避免重复路由报错 

const originalPush = VueRouter.prototype.push; 

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

};

如果有什么问题和疑问请在下方留言,文章为原创,转载请注明!