Selaa lähdekoodia

feat(form): add form field nested support (#591)

* feat(form): add form field nested support

* refactor(form): use lodash set replace
HUCHAOQI 4 vuotta sitten
vanhempi
commit
ec3d51d69b
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      src/components/Form/src/hooks/useFormValues.ts

+ 3 - 1
src/components/Form/src/hooks/useFormValues.ts

@@ -5,6 +5,8 @@ import { unref } from 'vue';
 import type { Ref, ComputedRef } from 'vue';
 import type { FormProps, FormSchema } from '../types/form';
 
+import { set } from 'lodash-es';
+
 interface UseFormValuesContext {
   defaultValueRef: Ref<any>;
   getSchema: ComputedRef<FormSchema[]>;
@@ -40,7 +42,7 @@ export function useFormValues({
       if (isString(value)) {
         value = value.trim();
       }
-      res[key] = value;
+      set(res, key, value);
     }
     return handleRangeTimeValue(res);
   }