我把index中命名空间去掉了 好用了 但是不知道具体原因
是上面这样么 还是不好使
命名空间模式 mapActions第一个参数需要传模块的模块名
如下示例:
export default {
methods: {
...mapActions('moduleKey', ['foo', 'bar'])
}
}
moduleKey的值为你在定义modules时候对应对象的key 比如下面的 foo
和 bar
const store = new Vuex.Store({
modules: {
foo: moduleFoo,
bar: moduleBar
}
})
参考 官方文档
13 回答12.8k 阅读
7 回答1.9k 阅读
3 回答1.1k 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
6 回答873 阅读✓ 已解决
6 回答1k 阅读
2 回答1.3k 阅读✓ 已解决
如果加上命名空间 你试下 ./getmessage
就像分包之后 指向action 要加上包路径一样
vuex
文档加了命名空间,就有了命名空间的嵌套了,一级的不需要加命名空间