feat(form): 支持 TextConfig handler 返回 Promise,buttonClickHandler 改为 async await

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
roymondchen 2026-05-14 19:32:19 +08:00
parent 2ad5101471
commit 54a5570419
2 changed files with 3 additions and 3 deletions

View File

@ -374,7 +374,7 @@ export interface TextConfig extends FormItem, Input {
setModel: (prop: string, value: any) => void;
setFormValue: (prop: string, value: any) => void;
},
) => void;
) => void | Promise<void>;
};
}

View File

@ -130,7 +130,7 @@ const inputHandler = (v: string) => {
mForm?.$emit('field-input', props.prop, v);
};
const buttonClickHandler = () => {
const buttonClickHandler = async () => {
if (!appendConfig.value) return;
if (typeof appendConfig.value.handler === 'function') {
const newChangeRecords: ChangeRecord[] = [];
@ -142,7 +142,7 @@ const buttonClickHandler = () => {
newChangeRecords.push({ propPath: key, value });
};
appendConfig.value.handler(mForm, {
await appendConfig.value.handler(mForm, {
model: props.model,
values: mForm ? readonly(mForm.initValues) : null,
formValue: props.values || {},