vuex的mapState无效

img

img
不知道为什么获取不到,哪位能帮忙解释一下啊,还是说我用错了?

你是拆分模块了么?
拆了的话就需要这样写了

computed: {
  ...mapState('模块名', ['模块中state的属性名']),
}

应该是用错了吧,要不远程给你看一下?
你可以参考我这篇文章
Vuex.Store 模块拆分成多个子模块_li.siyuan的博客-CSDN博客_vuex多个store 主 store 文件 引用 多个模块 每个模块下边有多个 module 文件引用顺序: main.js → store/index.js → test1/index.js → test1-1.module.js → test1-2.module.js → test2/index.js ... https://blog.csdn.net/qq_40602449/article/details/113123801