成功解决:Cannot read properties of undefined (reading ‘commit‘)

我真无语,我严重怀疑我在main.js中删除Avue的引入时、顺带删除了store

1、报错信息

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘commit’)
at VueComponent.mappedMutation (vuex.esm.js?358c:985:1)
at eval (Login.vue?03db:106:1)

2、报错原因

我的是在main.js中未引入配置的store

3、解决方法

加入配置的store
在这里插入图片描述

4、成功解决

登录的同时需要进行token的存储、需要调用store中的方法进行token的存储,但是未在全局引入。所以在使用时、报错

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43304253/article/details/126871726