From bfa72e344f6b39bef4cd83089562b8d023a1fa13 Mon Sep 17 00:00:00 2001 From: caiyuchao Date: Sat, 26 Jul 2025 14:50:53 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=AD=97=E5=85=B8=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=94=AF=E6=8C=81=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/dict-tag/dict-tag-group.vue | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) 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, + }); }); });