基本类型数据封装

export const sexList = [
  {
    dictId:0,
    dictName:'男',
    dictValue:'0',
    dictType:'sex',
    dictyDescription:'性别'
  },
  {
    dictId:0,
    dictName:'男',
    dictValue:'0',
    dictType:'sex',
    dictyDescription:'性别'
  },
]
/**
* @method 性别格式化
* @param  {Object} row 表格的一行数据
* @return {String} 名称
*/
function sexFormat(row) {
  if (row.sex === null || row.sex === undefined || row.sex === "") return
  const obj = sexList.find(
    e => e.dictValue === row.sex.toString()
  )
  return obj == null ? '' : obj.dictName
}
原文地址:https://www.cnblogs.com/0520euv/p/14886103.html