How the mutations of vuex calls getter? internally

export default new Vuex.Store({
  state: {
    cart_list:[1,2,3],
  },
  getters: {
    total: state => {
      var total = state.cart_list[0]+state.cart_list[1]+state.cart_list[2];
      return total;
    }
  },
  mutations: {
    get_total (state) { 
      console.log(">>>>>: getters>total ?");
    }
  }
})

my current implementation is to use one of the called components:

this.$store.commit("get_total",this.$store.getters.total);

is it right to pass in total?

Mar.20,2021

getter is equivalent to the calculation property of state , and mutation is used to modify state .
it is not a correct operation for mutation to modify getter directly.


this.getters.total (state)
this is an internal call within an object


you can pass the getter you want to use through action's context.getters ('getterName',obj) through action's context.getters (' getterName',obj) to obj as a parameter when submitting the getter via action.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b357d5-e4e9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b357d5-e4e9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?