vuex的几个参数的介绍

1.State         储存初始化数据

2.Getters      对State 里面的数据二次处理（对数据进行过滤类似filter的作用）比如State返回的为一个对象，我们想取对象中一个键的值用这个方法

3.Mutations   对数据进行计算的方法全部写在里面（类似computed） 在页面中触发时使用this.$store.commit('mutationName') 触发Mutations方法改变state的值

4.Actions      处理Mutations中已经写好的方法 其直接触发方式是 this.$store.dispatch(actionName)





建议： 状态管理模块化管理 （使得状态管理更加清晰明了）

A.在main.js 中注册 storeAll.js 
B.小模块的store 书写在store/modules中,然后在storeAll.js 注册模块


辅助函数
mapState：mapState 工具函数会将 store 中的 state 映射到局部计算属性中。
同理，mapActions, mapMutations都是一样的道理
使用store的state时候

1.利用计算属性：
import { mapState, mapActions } from "vuex";
computed: {
    ...mapState({ // 1.利用mapState属性
        Details: state => state.orderStore.Details,
        allCheckStatu: state => state.orderStore.allCheck
        orderMain: state => state.orderStore.orderMain
      }),
      headerTabs () { // 2.直接简单粗暴
        return this.$store.state.mmStore.headerTabs
      },
}
2 mapActions
import {  mapActions } from "vuex";
methods: {
    ...mapActions(['increment', 'decrement'])
}
3. import {  mapMutations } from "vuex";
methods: {
    ...mapMutations(['increment', 'decrement'])
}
4.触发状态改变的时候
this.$store.commit("initAll", rs);