mirror of
https://gitee.com/yudaocode/yudao-ui-admin-vben.git
synced 2025-12-30 02:22:25 +00:00
update src/utils/dict.ts.
64行getDictObj,原来采用forEach的话找到值之后return只会中断循环不会返回值,应改为for Signed-off-by: MeaoFun <1357423913@qq.com>
This commit is contained in:
@@ -64,10 +64,11 @@ export function getDictOptions(dictType: string, valueType?: 'string' | 'number'
|
||||
export function getDictObj(dictType: string, value: any) {
|
||||
const dictOptions: DictDataType[] = getDictDatas(dictType)
|
||||
if (dictOptions) {
|
||||
dictOptions.forEach((dict: DictDataType) => {
|
||||
if (dict.value === value.toString())
|
||||
for (const dict of dictOptions) {
|
||||
if (dict.value === value.toString()) {
|
||||
return dict
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user