[Solved] Vuex Error: unknown action type: changeUserInfo

Analyze the reason: this means that the method in actions cannot be read;

Troubleshooting:

Check whether there is a problem with the introduction:

1. In store/mutations.js If the exposure mode is export, you need to add {} when importing, as shown in the following code:

//export:

export {
    state,mutations,getters 
}

//import in store/index.js:
import {state,mutations,getters} from './mutations'

2. In store/actions.js If the exposure method is export default, you do not need to add {} when importing, as shown in the following code:

//export default:
export default {
    // modify userInfo
    changeUserInfo(context,obj){
        context.commit('changeUserInfo',obj);
        localStorage.setItem("userInfo",JSON.stringify(obj))
    }
}

//import in store/index.js:
import actions from './actions'

Read More: