vuex一直提示 [vuex] unknown mutation type: recruitmentArr

新手上路,请多包涵

main.js中的代码

store.commit('recruitmentArr', recruitmentArr);

mutations.js中的代码

import * as types from './mutation-types'
export default {
    [types.recruitmentArr] (state, val) {
        state.account = val
    }
}

mutation-types.js 中的代码

export const recruitmentArr = 'recruitmentArr'
阅读 2.3k
1 个回答
新手上路,请多包涵

通过console.log() 打印出mutations 为空对象
在mutations.js中console.log(types)后 刷新页面 竟然正常了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题