mirror of
https://github.com/vbenjs/gf-vben-admin.git
synced 2025-02-03 03:32:59 +08:00
feat: add the parameter submitOnReset to the form (#54)
This commit is contained in:
parent
74d4742406
commit
d09406e3cb
@ -266,7 +266,7 @@
|
||||
}
|
||||
|
||||
async function resetFields(): Promise<any> {
|
||||
const { resetFunc } = unref(getProps);
|
||||
const { resetFunc, submitOnReset } = unref(getProps);
|
||||
resetFunc && isFunction(resetFunc) && (await resetFunc());
|
||||
const formEl = unref(formElRef);
|
||||
if (!formEl) return;
|
||||
@ -276,6 +276,7 @@
|
||||
// const values = formEl.resetFields();
|
||||
emit('reset', toRaw(formModel));
|
||||
// return values;
|
||||
submitOnReset && handleSubmit();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -30,6 +30,10 @@ export const basicProps = {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
submitOnReset: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
size: {
|
||||
type: String as PropType<'default' | 'small' | 'large'>,
|
||||
default: 'default',
|
||||
|
@ -30,7 +30,8 @@ export type UseFormReturnType = [RegisterFn, FormActionType];
|
||||
export interface FormProps {
|
||||
// 整个表单所有项宽度
|
||||
labelWidth?: number | string;
|
||||
|
||||
// 重置时提交
|
||||
submitOnReset?: boolean;
|
||||
// 整个表单通用Col配置
|
||||
labelCol?: Partial<ColEx>;
|
||||
// 整个表单通用Col配置
|
||||
|
@ -9,6 +9,7 @@
|
||||
<BasicForm
|
||||
v-bind="getFormProps"
|
||||
v-if="getBindValues.useSearchForm"
|
||||
:submitOnReset="true"
|
||||
:submitButtonOptions="{ loading }"
|
||||
@register="registerForm"
|
||||
@submit="handleSearchInfoChange"
|
||||
|
Loading…
Reference in New Issue
Block a user