frontend/admin/src/store/modules/enumItem.js

(完整代码) 604B

// initial state
const state = {
  sexEnum: [{ key: 0, value: '男' }, { key: 1, value: '女' }, { key: 2, value: '保密' }],
  statusEnum: [{ key: 1, value: '启用' }, { key: 0, value: '禁用' }],
}

// getters
const getters = {
  enumFormat: () => (arrary, key) => {
    return format(arrary, key)
  }
}

// actions
const actions = {}

// mutations
const mutations = {}

const format = function (array, key) {
  for (let item of array) {
    if (item.key === key) {
      return item.value
    }
  }
  return null
}

export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。