refactor:selectDictLabel 回显数据字典方法更新
This commit is contained in:
parent
c8fb95a126
commit
c02c6eab68
@ -12,5 +12,14 @@ export interface DictDetail {
|
|||||||
is_default: boolean
|
is_default: boolean
|
||||||
}
|
}
|
||||||
export const selectDictLabel = (datas: DictDetail[], value: string) => {
|
export const selectDictLabel = (datas: DictDetail[], value: string) => {
|
||||||
return datas.find((item) => item.value === value)?.label
|
if (!value) {
|
||||||
|
return ''
|
||||||
|
} else {
|
||||||
|
const result = datas.find((item) => item.value === value)?.label
|
||||||
|
if (result === undefined) {
|
||||||
|
return '获取失败'
|
||||||
|
} else {
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user