Vue的Router在使用this.$router.push(url)出现错误
Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: “/home/news”.
错误如下
解决办法
在Vue项目的index.js项目中加入一下内容。
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}