This commit is contained in:
梁灏 2019-03-05 09:31:03 +08:00
parent f308dcac80
commit 4a8826fa02
2 changed files with 32 additions and 2 deletions

View file

@ -106,7 +106,8 @@
draggable: {
type: Boolean,
default: false
}
},
beforeClose: Function,
},
data () {
return {
@ -176,6 +177,21 @@
},
methods: {
close () {
if (!this.beforeClose) {
return this.handleClose();
}
const before = this.beforeClose();
if (before && before.then) {
before.then(() => {
this.handleClose();
});
} else {
this.handleClose();
}
},
handleClose () {
this.visible = false;
this.$emit('input', false);
this.$emit('on-close');