vuex跨模块的mapGetter和mapMutation
映射
...mapGetters("模块名",['字段名'])
...mapState("模块名",['字段名'])
直接操作
this.$store.getters["模块名/字段名"] this.$store.commit["模块名/方法名"]
映射别名
...mapState('some/xxx/module', {
a1: state => state.a,
b1: state => state.b
})
...mapMutaions('some/xxx/module', ['foo', 'bar'])
...mapActions('some/xxx/module', [
'foo', // -> this.foo()
'bar' // -> this.bar()
])

浙公网安备 33010602011771号