1.首先确认是否安装vue-router,安装命令:npm install vue-router
2.在main.js引入vue-router,import VueRouter from ‘vue-router’
3.在main.js中加入
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
这样就可以解决报错的问题啦~
VUE项目中报Uncaught (in promise) Error: Avoided redundant navigation to current location: 的错
最新推荐文章于 2024-10-02 11:56:31 发布