!74 update src/utils/dict.ts.

Merge pull request !74 from MeaoFun/N/A
master-vben2.0
芋道源码 2025-04-23 14:40:53 +00:00 committed by Gitee
commit 1193ccd0a8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 4 additions and 3 deletions

View File

@ -64,10 +64,11 @@ export function getDictOptions(dictType: string, valueType?: 'string' | 'number'
export function getDictObj(dictType: string, value: any) { export function getDictObj(dictType: string, value: any) {
const dictOptions: DictDataType[] = getDictDatas(dictType) const dictOptions: DictDataType[] = getDictDatas(dictType)
if (dictOptions) { if (dictOptions) {
dictOptions.forEach((dict: DictDataType) => { for (const dict of dictOptions) {
if (dict.value === value.toString()) if (dict.value === value.toString()) {
return dict return dict
}) }
}
} }
else { else {
return null return null