vue 控制台错误


控制台显示报错:

Uncaught TypeError: WEBPACK_IMPORTED_MODULE_1_vuex.a.store is not a constructor

解决办法:

将new Vuex.store中的“store”大写:new vuex.Store


控制台显示报错:

Uncaught (in promise) NavigationDuplicated:Avoided redundant navigation to current location: “/xxxxxx“.

问题出现原因:路由重复跳转

解决办法:

修改VueRouter原型对象上的push方法,在router文件夹下的index.js中加入如下代码:

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

 

posted @ 2021-10-26 09:24  辉太狼`  阅读(118)  评论(0编辑  收藏  举报