fix(form): dialog submit event获取到的changeRecords为空

This commit is contained in:
roymondchen 2025-10-28 11:22:08 +08:00
parent 979b834fac
commit cbec52936d
3 changed files with 8 additions and 5 deletions

View File

@ -101,8 +101,9 @@ watchEffect(() => {
const submitHandler = async () => {
try {
const changeRecords = form.value?.changeRecords;
const values = await form.value?.submitForm();
emit('submit', values, { changeRecords: form.value?.changeRecords });
emit('submit', values, { changeRecords });
} catch (e) {
emit('error', e);
}

View File

@ -42,7 +42,7 @@
</TMagicCol>
<TMagicCol :span="12">
<slot name="footer">
<TMagicButton @click="cancel" size="small"> </TMagicButton>
<TMagicButton type="default" @click="cancel" size="small"> </TMagicButton>
<TMagicButton v-if="hasStep && stepActive > 1" type="info" size="small" @click="preStep"
>上一步</TMagicButton
>
@ -131,8 +131,9 @@ const closeHandler = () => {
const save = async () => {
try {
const changeRecords = form.value?.changeRecords;
const values = await form.value?.submitForm();
emit('submit', values, { changeRecords: form.value?.changeRecords });
emit('submit', values, { changeRecords });
} catch (e) {
emit('error', e);
}

View File

@ -42,7 +42,7 @@
</TMagicCol>
<TMagicCol :span="12">
<slot name="footer">
<TMagicButton @click="handleClose">关闭</TMagicButton>
<TMagicButton type="default" @click="handleClose">关闭</TMagicButton>
<TMagicButton type="primary" :disabled="disabled" :loading="saveFetch" @click="submitHandler">{{
confirmText
}}</TMagicButton>
@ -109,8 +109,9 @@ watchEffect(() => {
const submitHandler = async () => {
try {
const changeRecords = form.value?.changeRecords;
const values = await form.value?.submitForm();
emit('submit', values, { changeRecords: form.value?.changeRecords });
emit('submit', values, { changeRecords });
} catch (e) {
emit('error', e);
}