Am I right to understand and use vuex in this way? If not, please give me some advice, thank you.

I have just been in contact with vue for a week, and my understanding of vuex is a little vague. Here is the vuex / moudles / com.js I used in the project. Can I write it this way? Is there anything wrong in understanding?

import * as types from "../type"


/** Action
 *  vuexstatecommitmutation
 *  Vuex 
 * 
 *  action state, state
 *  mutations  action  action  state
 * 
 *  commit  store  state ,action
 * 
 *  computed vuex
 *  getters  computed  getters,  store 
 */


/*APP  state*/
const state = {
    showSuccess: true,
    showFail: false,
    toastMsg: "",
    showToast: false
}

/* state  action*/
const actions = {
    showToast({commit}, state){
        commit(types.COM_SHOE_TOAST, state)
    },
    showSuccess({commit}, state){
        commit(types.COM_SHOW_SUCCESS, state)
    },
    showFail({commit}, state){
        commit(types.COM_SHOW_FAIL, state)
    },
    toastMsg({commit},str){
        commit(types.COM_TOAST_MSG, str)
    }
}

/**/
const getters = {
    showToast: state => state.showToast
}

/* state*/
const mutations = {
    [types.COM_SHOE_TOAST](state, status){
        state.COM_SHOE_TOAST = status
    },

    [types.COM_SHOW_SUCCESS](state, status){
        state.COM_SHOW_SUCCESS = status
    },

    [types.COM_SHOW_FAIL](state, status){
        state.COM_SHOW_FAIL = status
    },

    [types.COM_TOAST_MSG](state, str){
        state.COM_TOAST_MSG = str
    }
}

/**/
export default {
    state,
    actions,
    getters,
    mutations
}
How to write

in store.js? The above is a component of toast, which has not been implemented yet.

Aug.13,2021

import Vue from 'vue'
import Vuex from 'vuex'
import comfrom './modules/com'

Vue.use(Vuex)

const store = new Vuex.Store({
  modules: {
    com
  }
})

export default store

commit is essentially an instance of store, in which you can manipulate and obtain state, and then write it in action.
computed if you want to process and output data, you must use it for Filter, which is the calculation attribute of vuex
.

commit does not have to be written in action. Synchronize operations can be commit directly in the component.

computed is a calculation property of the vue component, not a calculation property of vuex. The calculation property of vuex is called getters

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-1b3ffd7-2c4e7.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-1b3ffd7-2c4e7.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?