vue-router.esm.js?8c4f:1000 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘_normalized’)
at normalizeLocation (vue-router.esm.js?8c4f:1000)
at Object.match (vue-router.esm.js?8c4f:1586)
at VueRouter.match (vue-router.esm.js?8c4f:2938)
at HTML5History.transitionTo (vue-router.esm.js?8c4f:2251)
at HTML5History.push (vue-router.esm.js?8c4f:2606)
at eval (vue-router.esm.js?8c4f:3034)
at new Promise ()
at VueRouter.push (vue-router.esm.js?8c4f:3033)
at VueComponent.activated (Home.vue?76f2:23)
at invokeWithErrorHandling (vue.runtime.esm.js?2b0e:1863)

router用active->push报错,但是页面可以正常跳转
在配置路由的js文件重写push方法
const routerPush = VueRouter.prototype.push

const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return routerPush.call(this, location).catch(error=> error)
}
Logo

前往低代码交流专区

更多推荐