Commit ec3d51d69b66500f4f604151255920460d1906ce
Committed by
GitHub
1 parent
4c16ffa3
feat(form): add form field nested support (#591)
* feat(form): add form field nested support * refactor(form): use lodash set replace
Showing
1 changed file
with
3 additions
and
1 deletions
src/components/Form/src/hooks/useFormValues.ts
@@ -5,6 +5,8 @@ import { unref } from 'vue'; | @@ -5,6 +5,8 @@ import { unref } from 'vue'; | ||
5 | import type { Ref, ComputedRef } from 'vue'; | 5 | import type { Ref, ComputedRef } from 'vue'; |
6 | import type { FormProps, FormSchema } from '../types/form'; | 6 | import type { FormProps, FormSchema } from '../types/form'; |
7 | 7 | ||
8 | +import { set } from 'lodash-es'; | ||
9 | + | ||
8 | interface UseFormValuesContext { | 10 | interface UseFormValuesContext { |
9 | defaultValueRef: Ref<any>; | 11 | defaultValueRef: Ref<any>; |
10 | getSchema: ComputedRef<FormSchema[]>; | 12 | getSchema: ComputedRef<FormSchema[]>; |
@@ -40,7 +42,7 @@ export function useFormValues({ | @@ -40,7 +42,7 @@ export function useFormValues({ | ||
40 | if (isString(value)) { | 42 | if (isString(value)) { |
41 | value = value.trim(); | 43 | value = value.trim(); |
42 | } | 44 | } |
43 | - res[key] = value; | 45 | + set(res, key, value); |
44 | } | 46 | } |
45 | return handleRangeTimeValue(res); | 47 | return handleRangeTimeValue(res); |
46 | } | 48 | } |