1、添加params参数
使用this.$router.push跳转相同路由时报
NavigationDuplicated: Avoided redundant navigation to current location
错误
在对参数没要求时可以添加一个随机参数
this.$router.push({
name: 'xxx', query: { xxx: xxx, xxx: xxx }, params: { xxx: Math.random() }
})
2、重写push方法
const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
return originalPush.call(this, location).catch(err => err)
}