提交 d09406e3 编写于 作者: V vben

feat: add the parameter submitOnReset to the form (#54)

上级 74d47424
...@@ -266,7 +266,7 @@ ...@@ -266,7 +266,7 @@
} }
async function resetFields(): Promise<any> { async function resetFields(): Promise<any> {
const { resetFunc } = unref(getProps); const { resetFunc, submitOnReset } = unref(getProps);
resetFunc && isFunction(resetFunc) && (await resetFunc()); resetFunc && isFunction(resetFunc) && (await resetFunc());
const formEl = unref(formElRef); const formEl = unref(formElRef);
if (!formEl) return; if (!formEl) return;
...@@ -276,6 +276,7 @@ ...@@ -276,6 +276,7 @@
// const values = formEl.resetFields(); // const values = formEl.resetFields();
emit('reset', toRaw(formModel)); emit('reset', toRaw(formModel));
// return values; // return values;
submitOnReset && handleSubmit();
} }
/** /**
......
...@@ -30,6 +30,10 @@ export const basicProps = { ...@@ -30,6 +30,10 @@ export const basicProps = {
type: Boolean, type: Boolean,
default: true, default: true,
}, },
submitOnReset: {
type: Boolean,
default: false,
},
size: { size: {
type: String as PropType<'default' | 'small' | 'large'>, type: String as PropType<'default' | 'small' | 'large'>,
default: 'default', default: 'default',
......
...@@ -30,7 +30,8 @@ export type UseFormReturnType = [RegisterFn, FormActionType]; ...@@ -30,7 +30,8 @@ export type UseFormReturnType = [RegisterFn, FormActionType];
export interface FormProps { export interface FormProps {
// 整个表单所有项宽度 // 整个表单所有项宽度
labelWidth?: number | string; labelWidth?: number | string;
// 重置时提交
submitOnReset?: boolean;
// 整个表单通用Col配置 // 整个表单通用Col配置
labelCol?: Partial<ColEx>; labelCol?: Partial<ColEx>;
// 整个表单通用Col配置 // 整个表单通用Col配置
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<BasicForm <BasicForm
v-bind="getFormProps" v-bind="getFormProps"
v-if="getBindValues.useSearchForm" v-if="getBindValues.useSearchForm"
:submitOnReset="true"
:submitButtonOptions="{ loading }" :submitButtonOptions="{ loading }"
@register="registerForm" @register="registerForm"
@submit="handleSearchInfoChange" @submit="handleSearchInfoChange"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册