store方法使用大全总结
一. state取值
1.直接从store实例取值

2.使用mapState取值的多种方法

模块里的写法
...mapState('moduleName', ['xxx']),
官网的文档

3.使用module中的state


二、mutation方法触发
1. 直接commit获取(store根目录注册了)

2、使用mapMutations 获取(月mapState类似)
直接commit方式

使用空间名方式

模块的写法
...mapMutations('moduleName', ['方法']),
官网

3.使用module中的mutation

module添加namespaced:true的方式使其成为带命名空间的模块
参考文档https://blog.csdn.net/trenki/article/details/106177150
官网https://vuex.vuejs.org/zh/guide/mutations.html

浙公网安备 33010602011771号