diff --git a/packages/base/data/modify-form.vue b/packages/base/data/modify-form.vue
index 1ece926..aa684a0 100644
--- a/packages/base/data/modify-form.vue
+++ b/packages/base/data/modify-form.vue
@@ -59,8 +59,12 @@
- {{ t(confirm) }}
- {{ t(cancel) }}
+ {{
+ t(typeof confirm === "string" && confirm ? confirm : "base.confirm")
+ }}
+ {{
+ t(typeof cancel === "string" && cancel ? cancel : "base.cancel")
+ }}
@@ -99,8 +103,8 @@ interface Props {
type?: string | null;
modify?: boolean;
items?: FormItem[];
- confirm?: string;
- cancel?: string;
+ confirm?: string | boolean | null;
+ cancel?: string | boolean | null;
}
const prop = withDefaults(defineProps(), {
@@ -111,8 +115,8 @@ const prop = withDefaults(defineProps(), {
type: null,
modify: false,
items: () => [],
- confirm: "base.confirm",
- cancel: "base.cancel",
+ confirm: undefined,
+ cancel: undefined,
});
const emit = defineEmits<{
diff --git a/plugs/composables/useModifyForm.ts b/plugs/composables/useModifyForm.ts
index a595efb..94089c7 100644
--- a/plugs/composables/useModifyForm.ts
+++ b/plugs/composables/useModifyForm.ts
@@ -22,12 +22,13 @@ interface Options {
handleEdit?: (value) => Promise;
handleCancel?: () => Promise;
handleError?: (kind: "validation" | "internal", err?) => void;
+ handleClose?: () => void;
init?: any;
extraProps?: string[] | "any" | ((code: string) => boolean);
}
export function useModifyForm(options: Options) {
- const { formRef, handleAdd, handleEdit, handleCancel, init, extraProps } = options;
+ const { formRef, handleAdd, handleEdit, handleCancel, handleClose, init, extraProps } = options;
const initValue = init ?? {};
const props = options.props ?? [];
const propMap = Object.fromEntries(props.map((prop) => [prop.code, prop]));
@@ -106,6 +107,7 @@ export function useModifyForm(options: Options) {
},
close() {
+ handleClose?.();
this.data.dialog = this.flagOnClose;
},