message: optimize code (#14029)

pull/14278/head
vok123 2019-01-30 19:25:26 +08:00 committed by hetech
parent 516f76e6cf
commit 4eefc2a552
1 changed files with 2 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<template>
<transition name="el-message-fade">
<transition name="el-message-fade" @after-leave="handleAfterLeave">
<div
:class="[
'el-message',
@ -61,14 +61,12 @@
closed(newVal) {
if (newVal) {
this.visible = false;
this.$el.addEventListener('transitionend', this.destroyElement);
}
}
},
methods: {
destroyElement() {
this.$el.removeEventListener('transitionend', this.destroyElement);
handleAfterLeave() {
this.$destroy(true);
this.$el.parentNode.removeChild(this.$el);
},