mirror of https://github.com/ElemeFE/element
retire transitionend
parent
813de47354
commit
2dd085b403
|
@ -36,8 +36,7 @@ exports.install = Vue => {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
if (el.domVisible) {
|
if (el.domVisible) {
|
||||||
const destroyElement = function() {
|
el.instance.$on('after-leave', _ => {
|
||||||
el.mask.removeEventListener('transitionend', destroyElement);
|
|
||||||
el.domVisible = false;
|
el.domVisible = false;
|
||||||
if (binding.modifiers.fullscreen && el.originalOverflow !== 'hidden') {
|
if (binding.modifiers.fullscreen && el.originalOverflow !== 'hidden') {
|
||||||
document.body.style.overflow = el.originalOverflow;
|
document.body.style.overflow = el.originalOverflow;
|
||||||
|
@ -47,8 +46,7 @@ exports.install = Vue => {
|
||||||
} else {
|
} else {
|
||||||
el.style.position = el.originalPosition;
|
el.style.position = el.originalPosition;
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
el.mask.addEventListener('transitionend', destroyElement);
|
|
||||||
el.instance.visible = false;
|
el.instance.visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,14 +17,6 @@ let fullscreenLoading;
|
||||||
LoadingConstructor.prototype.originalPosition = '';
|
LoadingConstructor.prototype.originalPosition = '';
|
||||||
LoadingConstructor.prototype.originalOverflow = '';
|
LoadingConstructor.prototype.originalOverflow = '';
|
||||||
|
|
||||||
const destroyElement = function() {
|
|
||||||
this.$el.removeEventListener('transitionend', destroyElement);
|
|
||||||
this.$el &&
|
|
||||||
this.$el.parentNode &&
|
|
||||||
this.$el.parentNode.removeChild(this.$el);
|
|
||||||
this.$destroy();
|
|
||||||
};
|
|
||||||
|
|
||||||
LoadingConstructor.prototype.close = function() {
|
LoadingConstructor.prototype.close = function() {
|
||||||
if (this.fullscreen && this.originalOverflow !== 'hidden') {
|
if (this.fullscreen && this.originalOverflow !== 'hidden') {
|
||||||
document.body.style.overflow = this.originalOverflow;
|
document.body.style.overflow = this.originalOverflow;
|
||||||
|
@ -37,7 +29,12 @@ LoadingConstructor.prototype.close = function() {
|
||||||
if (this.fullscreen) {
|
if (this.fullscreen) {
|
||||||
fullscreenLoading = undefined;
|
fullscreenLoading = undefined;
|
||||||
}
|
}
|
||||||
this.$el.addEventListener('transitionend', destroyElement.bind(this));
|
this.$on('after-leave', _ => {
|
||||||
|
this.$el &&
|
||||||
|
this.$el.parentNode &&
|
||||||
|
this.$el.parentNode.removeChild(this.$el);
|
||||||
|
this.$destroy();
|
||||||
|
});
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<transition name="el-loading-fade">
|
<transition name="el-loading-fade" @after-leave="handleAfterLeave">
|
||||||
<div
|
<div
|
||||||
v-show="visible"
|
v-show="visible"
|
||||||
class="el-loading-mask"
|
class="el-loading-mask"
|
||||||
|
@ -23,6 +23,12 @@
|
||||||
visible: false,
|
visible: false,
|
||||||
customClass: ''
|
customClass: ''
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
handleAfterLeave() {
|
||||||
|
this.$emit('after-leave');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue