NavigationDuplicated: Avoided redundant navigation to current location: “/home/login/homepage“

Vue路由重复点击时会出现报错 Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location:XXX,
NavigationDuplicated: Avoided redundant navigation to current location: “/home/login/homepage“_第1张图片
在router文件(也就是统一管理路由的文件)加一行代码就行

import VueRouter from 'vue-router'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
	return originalPush.call(this, location).catch(err => err)
}

这样就解决的报错!

你可能感兴趣的:(问题,javascript,vue.js,前端)