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