解决vue-router出现message: "Navigating to current location ("/admin/index") is not allowed"的问题

其缘由在于Vue-router在3.1以后把$router.push()方法改成了Promise。因此假如没有回调函数,错误信息就会交给全局的路由错误处理,所以就会报上述的错误。 vue-router先报了一个Uncaught (in promise)的错误(由于push没加回调),而后再点击路由的时候才会触发NavigationDuplicated的错误(路由出现的错误,全局错误处理打印了出来)
相关文章
相关标签/搜索