From c77fb9c84ac66f65dd6a3cea1e773de410fb7b30 Mon Sep 17 00:00:00 2001 From: chenminjie <943130926@qq.com> Date: Tue, 3 Dec 2024 18:09:15 +0800 Subject: [PATCH] fix: update form context to use rules instead of defaultValue for field validation --- packages/@core/ui-kit/form-ui/src/use-form-context.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@core/ui-kit/form-ui/src/use-form-context.ts b/packages/@core/ui-kit/form-ui/src/use-form-context.ts index 7bce3f2e..c6ee5412 100644 --- a/packages/@core/ui-kit/form-ui/src/use-form-context.ts +++ b/packages/@core/ui-kit/form-ui/src/use-form-context.ts @@ -43,7 +43,7 @@ export function useFormInitial( if (Reflect.has(item, 'defaultValue')) { set(initialValues, item.fieldName, item.defaultValue); } else if (item.rules && !isString(item.rules)) { - set(zodObject, item.fieldName, item.defaultValue); + set(zodObject, item.fieldName, item.rules); } });