This commit is contained in:
梁灏 2019-06-05 09:26:44 +08:00
parent ceae82348b
commit ff71751caa

View file

@ -23,7 +23,8 @@ Modal.newInstance = properties => {
loading: false,
buttonLoading: false,
scrollable: false,
closable: false
closable: false,
closing: false // 关闭有动画,期间使用此属性避免重复点击
}),
render (h) {
let footerVNodes = [];
@ -158,12 +159,14 @@ Modal.newInstance = properties => {
},
methods: {
cancel () {
if (this.closing) return;
this.$children[0].visible = false;
this.buttonLoading = false;
this.onCancel();
this.remove();
},
ok () {
if (this.closing) return;
if (this.loading) {
this.buttonLoading = true;
} else {
@ -173,7 +176,9 @@ Modal.newInstance = properties => {
this.onOk();
},
remove () {
this.closing = true;
setTimeout(() => {
this.closing = false;
this.destroy();
}, 300);
},