Commit af54b0fbc6a69b77114f290514bd8d7c80c068ff
Committed by
GitHub
1 parent
4418eccf
feat: 多路径字段获取值 (#2664)
Showing
1 changed file
with
3 additions
and
4 deletions
src/components/Form/src/hooks/useFormEvents.ts
@@ -14,7 +14,7 @@ import { | @@ -14,7 +14,7 @@ import { | ||
14 | import { deepMerge } from '/@/utils'; | 14 | import { deepMerge } from '/@/utils'; |
15 | import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper'; | 15 | import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper'; |
16 | import { dateUtil } from '/@/utils/dateUtil'; | 16 | import { dateUtil } from '/@/utils/dateUtil'; |
17 | -import { cloneDeep, set, uniqBy } from 'lodash-es'; | 17 | +import { cloneDeep, set, uniqBy, get } from 'lodash-es'; |
18 | import { error } from '/@/utils/log'; | 18 | import { error } from '/@/utils/log'; |
19 | 19 | ||
20 | interface UseFormActionContext { | 20 | interface UseFormActionContext { |
@@ -112,9 +112,8 @@ export function useFormEvents({ | @@ -112,9 +112,8 @@ export function useFormEvents({ | ||
112 | const validKeys: string[] = []; | 112 | const validKeys: string[] = []; |
113 | fields.forEach((key) => { | 113 | fields.forEach((key) => { |
114 | const schema = unref(getSchema).find((item) => item.field === key); | 114 | const schema = unref(getSchema).find((item) => item.field === key); |
115 | - let value = values[key]; | ||
116 | - | ||
117 | - const hasKey = Reflect.has(values, key); | 115 | + let value = get(values, key); |
116 | + const hasKey = !!get(values, key); | ||
118 | 117 | ||
119 | value = handleInputNumberValue(schema?.component, value); | 118 | value = handleInputNumberValue(schema?.component, value); |
120 | const { componentProps } = schema || {}; | 119 | const { componentProps } = schema || {}; |