Browse Source
feat(form): add form field nested support (#591)
* feat(form): add form field nested support
* refactor(form): use lodash set replace
pull/605/head
HUCHAOQI
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
3 additions and
1 deletions
-
src/components/Form/src/hooks/useFormValues.ts
|
|
@ -5,6 +5,8 @@ import { unref } from 'vue'; |
|
|
import type { Ref, ComputedRef } from 'vue'; |
|
|
import type { Ref, ComputedRef } from 'vue'; |
|
|
import type { FormProps, FormSchema } from '../types/form'; |
|
|
import type { FormProps, FormSchema } from '../types/form'; |
|
|
|
|
|
|
|
|
|
|
|
import { set } from 'lodash-es'; |
|
|
|
|
|
|
|
|
interface UseFormValuesContext { |
|
|
interface UseFormValuesContext { |
|
|
defaultValueRef: Ref<any>; |
|
|
defaultValueRef: Ref<any>; |
|
|
getSchema: ComputedRef<FormSchema[]>; |
|
|
getSchema: ComputedRef<FormSchema[]>; |
|
|
@ -40,7 +42,7 @@ export function useFormValues({ |
|
|
if (isString(value)) { |
|
|
if (isString(value)) { |
|
|
value = value.trim(); |
|
|
value = value.trim(); |
|
|
} |
|
|
} |
|
|
res[key] = value; |
|
|
set(res, key, value); |
|
|
} |
|
|
} |
|
|
return handleRangeTimeValue(res); |
|
|
return handleRangeTimeValue(res); |
|
|
} |
|
|
} |
|
|
|