Modal add before-close prop
This commit is contained in:
parent
ce92e4add3
commit
95bf1bfae9
2 changed files with 34 additions and 2 deletions
|
@ -150,7 +150,8 @@
|
|||
zIndex: {
|
||||
type: Number,
|
||||
default: 1000
|
||||
}
|
||||
},
|
||||
beforeClose: Function
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
|
@ -259,6 +260,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-cancel');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue