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?