主要原因是Vue 重復點擊相同路由造成的:
解決方案:
第一種:在 router 文件夾下里面的文件index.js里面找到如下位置:
// src/router/index.js
Vue.use(Router)
const router = new Router({
routes
})
找到上面位置,在下面增加這段代碼即可。
const VueRouterPush = Router.prototype.push
Router.prototype.push = function push (to) {
return VueRouterPush.call(this, to).catch(err => err)
}
參考鏈接:https://blog.csdn.net/qq_36437172/article/details/108269846