vue再连续多次点击同一路由的时候,会报以下错误:
Avoided redundant navigation to current location: '/xxx
可以通过在main.js 或路由配置文件(index.js)中重写push的方法,解决该问题
import VueRouter from 'vue-router'
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}