Browse Source

多状态回显优化

master
陈薪名 10 months ago
parent
commit
8d5de189eb
  1. 6
      src/components/DictTag/src/DictTag.vue

6
src/components/DictTag/src/DictTag.vue

@ -2,7 +2,7 @@
import { defineComponent, PropType, ref } from 'vue' import { defineComponent, PropType, ref } from 'vue'
import { isHexColor } from '@/utils/color' import { isHexColor } from '@/utils/color'
import { ElTag } from 'element-plus' import { ElTag } from 'element-plus'
import { DictDataType, getStrDictOptions } from '@/utils/dict' import { DictDataType, getDictOptions } from '@/utils/dict'
export default defineComponent({ export default defineComponent({
name: 'DictTag', name: 'DictTag',
@ -22,12 +22,12 @@ export default defineComponent({
const getDictObj = (dictType: string, value: string) => { const getDictObj = (dictType: string, value: string) => {
// //
if (value.indexOf(',') == -1) { if (value.indexOf(',') == -1) {
const dictOptions = getStrDictOptions(dictType) const dictOptions = getDictOptions(dictType)
dictData.value = dictOptions.find(dictOptionsItem => (dictOptionsItem.value == value)) dictData.value = dictOptions.find(dictOptionsItem => (dictOptionsItem.value == value))
} else { } else {
dictDataList = [] dictDataList = []
value.split(',').forEach(item => { value.split(',').forEach(item => {
const dictOptions = getStrDictOptions(dictType) const dictOptions = getDictOptions(dictType)
dictDataList.push(dictOptions.find(dictOptionsItem => (dictOptionsItem.value == item))) dictDataList.push(dictOptions.find(dictOptionsItem => (dictOptionsItem.value == item)))
}) })
} }

Loading…
Cancel
Save