From 0b97c0791013c6156adbd47794b7333799d8015e Mon Sep 17 00:00:00 2001 From: Kyrielin Date: Fri, 18 Mar 2022 18:23:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=20form=20submit=20?= =?UTF-8?q?=E6=8A=A5=E9=94=99=20(#510)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/form/hooks/useInstance.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/form/hooks/useInstance.tsx b/src/form/hooks/useInstance.tsx index f29f48e0d..60cf4d7f4 100644 --- a/src/form/hooks/useInstance.tsx +++ b/src/form/hooks/useInstance.tsx @@ -41,10 +41,10 @@ export default function useInstance(props: TdFormProps, formRef, formItemsRef) { } // 对外方法 手动提交表单 - function submit(e: React.FormEvent) { + function submit(e?: React.FormEvent) { if (preventSubmitDefault) { - e.preventDefault?.(); - e.stopPropagation?.(); + e?.preventDefault?.(); + e?.stopPropagation?.(); } validate().then((r) => { const firstError = getFirstError(r);