vue-router.esm.js?8c4f:2089 Uncaught (in promise) NavigationDuplicated {_name: "NavigationDuplicated", name: "NavigationDuplicated", message: "Navigating to current location ("/jieshao") is not allowed", stack: "Error↵ at new NavigationDuplicated (webpack-int…node_modules/vue/dist/vue.runtime.esm.js:1853:26)"}
在main.js 添加以下内容
//this.$router.push 相同地址报错的解决办法
import Router from 'vue-router' // 需要引入一下路由才会 有push方法
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
发表评论