refactor: 字典类型支持数组

This commit is contained in:
caiyuchao
2025-07-26 14:50:53 +08:00
parent 9fda364dab
commit bfa72e344f

View File

@@ -10,7 +10,7 @@ interface DictTagGroupProps {
/** /**
* 字典类型 * 字典类型
*/ */
type: string; type: string[];
/** /**
* 字典值 * 字典值
*/ */
@@ -31,9 +31,10 @@ const dictTag = computed(() => {
} }
const dictTagGroup: any[] = []; const dictTagGroup: any[] = [];
props.value.forEach((value) => { props.type.forEach((type) => {
props.value?.forEach((value) => {
// 获取字典对象 // 获取字典对象
const dict = getDictObj(props.type, String(value)); const dict = getDictObj(type, String(value));
if (!dict) { if (!dict) {
return null; return null;
} }
@@ -64,6 +65,7 @@ const dictTag = computed(() => {
colorType, colorType,
}); });
}); });
});
return dictTagGroup; return dictTagGroup;
}); });