mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2026-06-04 02:54:20 +08:00
feat(form): 支持 TextConfig handler 返回 Promise,buttonClickHandler 改为 async await
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
2ad5101471
commit
54a5570419
@ -374,7 +374,7 @@ export interface TextConfig extends FormItem, Input {
|
|||||||
setModel: (prop: string, value: any) => void;
|
setModel: (prop: string, value: any) => void;
|
||||||
setFormValue: (prop: string, value: any) => void;
|
setFormValue: (prop: string, value: any) => void;
|
||||||
},
|
},
|
||||||
) => void;
|
) => void | Promise<void>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -130,7 +130,7 @@ const inputHandler = (v: string) => {
|
|||||||
mForm?.$emit('field-input', props.prop, v);
|
mForm?.$emit('field-input', props.prop, v);
|
||||||
};
|
};
|
||||||
|
|
||||||
const buttonClickHandler = () => {
|
const buttonClickHandler = async () => {
|
||||||
if (!appendConfig.value) return;
|
if (!appendConfig.value) return;
|
||||||
if (typeof appendConfig.value.handler === 'function') {
|
if (typeof appendConfig.value.handler === 'function') {
|
||||||
const newChangeRecords: ChangeRecord[] = [];
|
const newChangeRecords: ChangeRecord[] = [];
|
||||||
@ -142,7 +142,7 @@ const buttonClickHandler = () => {
|
|||||||
newChangeRecords.push({ propPath: key, value });
|
newChangeRecords.push({ propPath: key, value });
|
||||||
};
|
};
|
||||||
|
|
||||||
appendConfig.value.handler(mForm, {
|
await appendConfig.value.handler(mForm, {
|
||||||
model: props.model,
|
model: props.model,
|
||||||
values: mForm ? readonly(mForm.initValues) : null,
|
values: mForm ? readonly(mForm.initValues) : null,
|
||||||
formValue: props.values || {},
|
formValue: props.values || {},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user