Navigating to current location ("/") is not allowed
重写路由的push方法
在src/router/index.js 里面import Router from 'vue-router'
下面写入下面方法即可
/** * 重写路由的push方法 */ const routerPush = Router.prototype.push Router.prototype.push = function push(location) { return routerPush.call(this, location).catch(error=> error) }
------------------------------------------------------------------------------------------------------
转自:https://blog.csdn.net/weixin_43606809/article/details/103040805
本文来自博客园,作者:margo,转载请注明原文链接:https://www.cnblogs.com/ZMargo/articles/11887910.html