dict.js
588 Bytes
import { getAllDict } from '@/api/dict'
const state = {
dicData: {},
addDict: false,
}
const mutations = {
SET_DATA: (state, data) => {
state.addDict = true
state.dicData = data
},
RESET_DICT: (state) => {
state.addDict = false
}
}
const actions = {
generateDic ({ commit }) {
return new Promise(async (resolve) => {
let { result: res } = await getAllDict()
commit('SET_DATA', res)
resolve(true)
})
},
resetdict ({ commit }) {
commit('RESET_DICT')
}
}
export default {
namespaced: true,
state,
mutations,
actions
}