diff --git a/apps/web-antd/src/components/dict-tag/dict-tag-group.vue b/apps/web-antd/src/components/dict-tag/dict-tag-group.vue index 7b0ca76..3085925 100644 --- a/apps/web-antd/src/components/dict-tag/dict-tag-group.vue +++ b/apps/web-antd/src/components/dict-tag/dict-tag-group.vue @@ -10,7 +10,7 @@ interface DictTagGroupProps { /** * 字典类型 */ - type: string; + type: string[]; /** * 字典值 */ @@ -31,37 +31,39 @@ const dictTag = computed(() => { } const dictTagGroup: any[] = []; - props.value.forEach((value) => { - // 获取字典对象 - const dict = getDictObj(props.type, String(value)); - if (!dict) { - return null; - } + props.type.forEach((type) => { + props.value?.forEach((value) => { + // 获取字典对象 + const dict = getDictObj(type, String(value)); + if (!dict) { + return null; + } - // 处理颜色类型 - let colorType = dict.colorType; - switch (colorType) { - case 'danger': { - colorType = 'error'; - break; - } - case 'info': { - colorType = 'default'; - break; - } - case 'primary': { - colorType = 'processing'; - break; - } - default: { - if (!colorType) { + // 处理颜色类型 + let colorType = dict.colorType; + switch (colorType) { + case 'danger': { + colorType = 'error'; + break; + } + case 'info': { colorType = 'default'; + break; + } + case 'primary': { + colorType = 'processing'; + break; + } + default: { + if (!colorType) { + colorType = 'default'; + } } } - } - dictTagGroup.push({ - label: dict.label || '', - colorType, + dictTagGroup.push({ + label: dict.label || '', + colorType, + }); }); });