Skip to content

Commit

Permalink
fix: 修复afterSubmit返回false仍然关闭对话框的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
greper committed Oct 27, 2023
1 parent 26ff43b commit 80337ff
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/fast-admin/fs-admin-antdv
2 changes: 1 addition & 1 deletion packages/fast-admin/fs-admin-antdv4
2 changes: 1 addition & 1 deletion packages/fast-admin/fs-admin-element
2 changes: 1 addition & 1 deletion packages/fast-admin/fs-admin-naive-ui
5 changes: 4 additions & 1 deletion packages/fast-crud/src/components/crud/fs-form-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ export default defineComponent({
async function submit() {
loading.value = true;
try {
await formRef.value.submit();
const success = await formRef.value.submit();
if (success === false) {
return;
}
close();
} finally {
loading.value = false;
Expand Down
6 changes: 3 additions & 3 deletions packages/fast-crud/src/components/crud/fs-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ export default defineComponent({
if (props.beforeSubmit) {
const ret = await props.beforeSubmit(submitScope);
if (ret === false) {
return;
return false;
}
}
Expand All @@ -532,14 +532,14 @@ export default defineComponent({
const res = await props.doSubmit(submitScope);
submitScope.res = res;
if (res === false) {
return;
return false;
}
}
ctx.emit("submit", submitScope);
if (props.afterSubmit) {
const success = await props.afterSubmit(submitScope);
if (success === false) {
return;
return false;
}
}
ctx.emit("success", submitScope);
Expand Down

0 comments on commit 80337ff

Please sign in to comment.