Skip to content

Commit 7697e5c

Browse files
author
puhui999
committed
add: 添加获取指定字典指定值对应的label数据
1 parent aad49fd commit 7697e5c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/utils/dict.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,16 @@ export const getDictObj = (dictType: string, value: any) => {
6969
}
7070
})
7171
}
72-
72+
export const getDictLabel = (dictType: string, value: any) => {
73+
const dictOptions: DictDataType[] = getDictOptions(dictType)
74+
const dictLabel = ref('')
75+
dictOptions.forEach((dict: DictDataType) => {
76+
if (dict.value === value) {
77+
dictLabel.value = dict.label
78+
}
79+
})
80+
return dictLabel.value
81+
}
7382
export enum DICT_TYPE {
7483
USER_TYPE = 'user_type',
7584
COMMON_STATUS = 'common_status',

0 commit comments

Comments
 (0)