breaking change(Dialog): adjust before-close usage

This commit is contained in:
chenjiahan
2020-09-06 10:16:54 +08:00
parent c9f0f11028
commit 21c30cbbf8
6 changed files with 49 additions and 34 deletions
+10 -4
View File
@@ -1,6 +1,7 @@
import { reactive } from 'vue';
// Utils
import { callInterceptor } from '../utils/interceptor';
import { createNamespace, addUnit, pick } from '../utils';
import { BORDER_TOP, BORDER_LEFT } from '../utils/constant';
@@ -82,11 +83,16 @@ export default createComponent({
if (props.beforeClose) {
loading[action] = true;
props.beforeClose(action, (result) => {
if (result !== false && loading[action]) {
callInterceptor({
interceptor: props.beforeClose,
args: [action],
done() {
close(action);
}
loading[action] = false;
loading[action] = false;
},
canceled() {
loading[action] = false;
},
});
} else {
close(action);