fix: form enter event handling, fixed #4865 (#4867)

pull/48/MERGE
Netfan 2024-11-12 13:20:48 +08:00 committed by GitHub
parent ea8af98324
commit 1ff1e4a8d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 3 deletions

View File

@ -40,6 +40,13 @@ const handleUpdateCollapsed = (value: boolean) => {
};
function handleKeyDownEnter(event: KeyboardEvent) {
if (
!state.value.submitOnEnter ||
!formActionsRef.value ||
!formActionsRef.value.handleSubmit
) {
return;
}
// textarea
// textarea
if (event.target instanceof HTMLTextAreaElement) {
@ -47,9 +54,6 @@ function handleKeyDownEnter(event: KeyboardEvent) {
}
event.preventDefault();
if (!state.value.submitOnEnter || !formActionsRef.value) {
return;
}
formActionsRef.value?.handleSubmit?.();
}
</script>