From 6cd9937c0389395eaeae87d775b25ddc98b1295c Mon Sep 17 00:00:00 2001 From: Vben Date: Thu, 17 Oct 2024 22:53:05 +0800 Subject: [PATCH] feat: add submitOnEnter configuration to form (#4670) --- docs/src/components/common-ui/vben-form.md | 1 + .../ui-kit/form-ui/src/components/form-actions.vue | 5 +++++ packages/@core/ui-kit/form-ui/src/form-api.ts | 1 + packages/@core/ui-kit/form-ui/src/types.ts | 7 ++++++- packages/@core/ui-kit/form-ui/src/vben-use-form.vue | 13 +++++++++++++ playground/src/views/examples/form/basic.vue | 1 + playground/src/views/examples/vxe-table/form.vue | 2 ++ 7 files changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/src/components/common-ui/vben-form.md b/docs/src/components/common-ui/vben-form.md index f9a89857261..5c2e3c94082 100644 --- a/docs/src/components/common-ui/vben-form.md +++ b/docs/src/components/common-ui/vben-form.md @@ -311,6 +311,7 @@ useVbenForm 返回的第二个参数,是一个对象,包含了一些表单 | collapsedRows | 折叠时保持的行数 | `number` | `1` | | commonConfig | 表单项的通用配置,每个配置都会传递到每个表单项,表单项可覆盖 | `FormCommonConfig` | - | | schema | 表单项的每一项配置 | `FormSchema` | - | +| submitOnEnter | 按下回车健时提交表单 | `boolean` | false | ### TS 类型说明 diff --git a/packages/@core/ui-kit/form-ui/src/components/form-actions.vue b/packages/@core/ui-kit/form-ui/src/components/form-actions.vue index 1b1cbef9597..460dc18f672 100644 --- a/packages/@core/ui-kit/form-ui/src/components/form-actions.vue +++ b/packages/@core/ui-kit/form-ui/src/components/form-actions.vue @@ -75,6 +75,11 @@ watch( } }, ); + +defineExpose({ + handleReset, + handleSubmit, +});