parent
ceae82348b
commit
ff71751caa
1 changed files with 7 additions and 2 deletions
|
@ -23,7 +23,8 @@ Modal.newInstance = properties => {
|
||||||
loading: false,
|
loading: false,
|
||||||
buttonLoading: false,
|
buttonLoading: false,
|
||||||
scrollable: false,
|
scrollable: false,
|
||||||
closable: false
|
closable: false,
|
||||||
|
closing: false // 关闭有动画,期间使用此属性避免重复点击
|
||||||
}),
|
}),
|
||||||
render (h) {
|
render (h) {
|
||||||
let footerVNodes = [];
|
let footerVNodes = [];
|
||||||
|
@ -158,12 +159,14 @@ Modal.newInstance = properties => {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
cancel () {
|
cancel () {
|
||||||
|
if (this.closing) return;
|
||||||
this.$children[0].visible = false;
|
this.$children[0].visible = false;
|
||||||
this.buttonLoading = false;
|
this.buttonLoading = false;
|
||||||
this.onCancel();
|
this.onCancel();
|
||||||
this.remove();
|
this.remove();
|
||||||
},
|
},
|
||||||
ok () {
|
ok () {
|
||||||
|
if (this.closing) return;
|
||||||
if (this.loading) {
|
if (this.loading) {
|
||||||
this.buttonLoading = true;
|
this.buttonLoading = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -173,7 +176,9 @@ Modal.newInstance = properties => {
|
||||||
this.onOk();
|
this.onOk();
|
||||||
},
|
},
|
||||||
remove () {
|
remove () {
|
||||||
|
this.closing = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
this.closing = false;
|
||||||
this.destroy();
|
this.destroy();
|
||||||
}, 300);
|
}, 300);
|
||||||
},
|
},
|
||||||
|
@ -270,4 +275,4 @@ Modal.newInstance = properties => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export default Modal;
|
export default Modal;
|
||||||
|
|
Loading…
Add table
Reference in a new issue