Commit d09406e3cb8cfc069ce79b5f4194f7d959f63daf
1 parent
74d47424
feat: add the parameter submitOnReset to the form (#54)
Showing
4 changed files
with
9 additions
and
2 deletions
src/components/Form/src/BasicForm.vue
... | ... | @@ -266,7 +266,7 @@ |
266 | 266 | } |
267 | 267 | |
268 | 268 | async function resetFields(): Promise<any> { |
269 | - const { resetFunc } = unref(getProps); | |
269 | + const { resetFunc, submitOnReset } = unref(getProps); | |
270 | 270 | resetFunc && isFunction(resetFunc) && (await resetFunc()); |
271 | 271 | const formEl = unref(formElRef); |
272 | 272 | if (!formEl) return; |
... | ... | @@ -276,6 +276,7 @@ |
276 | 276 | // const values = formEl.resetFields(); |
277 | 277 | emit('reset', toRaw(formModel)); |
278 | 278 | // return values; |
279 | + submitOnReset && handleSubmit(); | |
279 | 280 | } |
280 | 281 | |
281 | 282 | /** | ... | ... |
src/components/Form/src/props.ts
src/components/Form/src/types/form.ts
... | ... | @@ -30,7 +30,8 @@ export type UseFormReturnType = [RegisterFn, FormActionType]; |
30 | 30 | export interface FormProps { |
31 | 31 | // 整个表单所有项宽度 |
32 | 32 | labelWidth?: number | string; |
33 | - | |
33 | + // 重置时提交 | |
34 | + submitOnReset?: boolean; | |
34 | 35 | // 整个表单通用Col配置 |
35 | 36 | labelCol?: Partial<ColEx>; |
36 | 37 | // 整个表单通用Col配置 | ... | ... |
src/components/Table/src/BasicTable.vue