Commit 4eefc2a5 authored by vok123's avatar vok123 Committed by hetech

message: optimize code (#14029)

parent 516f76e6
<template> <template>
<transition name="el-message-fade"> <transition name="el-message-fade" @after-leave="handleAfterLeave">
<div <div
:class="[ :class="[
'el-message', 'el-message',
...@@ -61,14 +61,12 @@ ...@@ -61,14 +61,12 @@
closed(newVal) { closed(newVal) {
if (newVal) { if (newVal) {
this.visible = false; this.visible = false;
this.$el.addEventListener('transitionend', this.destroyElement);
} }
} }
}, },
methods: { methods: {
destroyElement() { handleAfterLeave() {
this.$el.removeEventListener('transitionend', this.destroyElement);
this.$destroy(true); this.$destroy(true);
this.$el.parentNode.removeChild(this.$el); this.$el.parentNode.removeChild(this.$el);
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment