How to call mutations defined in modules by vuex,

The

status can be obtained and has been tinkering with for a long time. Do not know how to call mutations, getters and actions defined in the module?

    const mA = {
      state : {
        a : 1,
        b : 1,
      },
      //  mutations
      mutations : {
        add : state =>{
          state.aPP
        },
      },
      getters : {
        double : state=> {
          return state.a *2
        }
      }
    }
    const mB = {
      state : {
        a : 2,
        b : 2,
      },
      //  mutations
      mutations: {
        addB: state => {
          state.aPP
        },
      },
      //  actions
      actions : {
        asyncAdd : ({commit, rootState ,state}) =>{
          setTimeout(() => {
            commit("add");
          }, 1000);
        }
      }
    }
    const store = new Vuex.Store({
      modules : {
        a : mA,
        b : mB,
      }
    });
    console.log(store.state.a);
Jul.21,2021
The commit in the

component calls the method in mutation to modify the variables in state. Dispatch calls the actions in actions, which generally handles asynchronous methods. After a good study of vuex's documents, it is quite clear that there are also many demo's


on GitHub.

generally, the status of state is obtained from the module namespace through getter

  

(1) call
this.$store.commit ('mA/add')
in vue (2) call
store.commit (' mA/add')

in js
Menu