uniApp 使用Vuex 出现 Cannot read properties of undefined (reading ‘commit‘)情况
最新推荐文章于 2024-08-05 15:38:03 发布
在uniApp开发中,尝试使用Vuex时遇到错误:Cannot read properties of undefined (reading 'commit')。问题出现在函数内部通过this.$store获取到的是undefined。解决方法是不依赖this实例,而是直接通过import引入的store实例进行操作,从而确保与Vue同步。
摘要由CSDN通过智能技术生成