Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions packages/components/form/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const Form = forwardRefWithStatics(
resetType,
rules,
errorMessage = globalFormConfig.errorMessage,
preventSubmitDefault,
disabled,
readonly,
children,
Expand Down Expand Up @@ -81,15 +80,6 @@ const Form = forwardRefWithStatics(
onValuesChange(changedValue, allFields);
}

function onKeyDownHandler(e: React.KeyboardEvent<HTMLFormElement>) {
// 禁用 input 输入框回车自动提交 form
if ((e.target as Element).tagName.toLowerCase() !== 'input') return;
if (preventSubmitDefault && e.key === 'Enter') {
e.preventDefault?.();
e.stopPropagation?.();
}
}

return (
<FormContext.Provider
value={{
Expand Down Expand Up @@ -121,7 +111,6 @@ const Form = forwardRefWithStatics(
className={formClass}
onSubmit={formInstance.submit}
onReset={onResetHandler}
onKeyDown={onKeyDownHandler}
>
{children}
</form>
Expand Down
Loading