vuex报错 this.$store显示undefined
vuex报错 this.$store显示undefined
·
vuex报错 this.$store显示undefined
调试vuex的时候 发现报以下错误,并且打印 this.$store 显示是undefined
报错:
[Vue warn]: Error in render: “TypeError: Cannot read properties of undefined (reading ‘state’)”
TypeError: Cannot read properties of undefined (reading ‘state’)
问题原因:
- vuex 和 vue 版本号不对应, vue2 对应vuex3, vue3 对应vuex4(去package.json文件中查看)
- store.js中
new Vuex.Store()
Store 要大写 ,Vuex.store这种写法可能也会报错
更多推荐
所有评论(0)