出現的錯誤:
出現這個錯誤的原因是,在路由跳轉的時候兩次push的path地址相同
解決方法兩種:
1.切換版本回3.0版本
2.在你引了vue-router的js文件里加上如下代碼即可
/**
* 重寫路由的push方法
*/
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(error=> error)
}