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 | 5 | import type { Ref, ComputedRef } from 'vue'; |
6 | 6 | import type { FormProps, FormSchema } from '../types/form'; |
7 | 7 | |
8 | +import { set } from 'lodash-es'; | |
9 | + | |
8 | 10 | interface UseFormValuesContext { |
9 | 11 | defaultValueRef: Ref<any>; |
10 | 12 | getSchema: ComputedRef<FormSchema[]>; |
... | ... | @@ -40,7 +42,7 @@ export function useFormValues({ |
40 | 42 | if (isString(value)) { |
41 | 43 | value = value.trim(); |
42 | 44 | } |
43 | - res[key] = value; | |
45 | + set(res, key, value); | |
44 | 46 | } |
45 | 47 | return handleRangeTimeValue(res); |
46 | 48 | } | ... | ... |