Commit d51f0887 authored by Alexandre Mouillard's avatar Alexandre Mouillard Committed by 杨奕

Notification: add onClick handler

parent bcbd94f4
......@@ -6,7 +6,8 @@
v-show="visible"
:style="{ top: top ? top + 'px' : 'auto' }"
@mouseenter="clearTimer()"
@mouseleave="startTimer()">
@mouseleave="startTimer()"
@click="click">
<i
class="el-notification__icon"
:class="[ typeClass, iconClass ]"
......@@ -15,7 +16,7 @@
<div class="el-notification__group" :class="{ 'is-with-icon': typeClass || iconClass }">
<h2 class="el-notification__title" v-text="title"></h2>
<div class="el-notification__content"><slot>{{ message }}</slot></div>
<div class="el-notification__closeBtn el-icon-close" @click="close"></div>
<div class="el-notification__closeBtn el-icon-close" @click.stop="close"></div>
</div>
</div>
</transition>
......@@ -40,6 +41,7 @@
customClass: '',
iconClass: '',
onClose: null,
onClick: null,
closed: false,
top: null,
timer: null
......@@ -68,6 +70,12 @@
this.$el.parentNode.removeChild(this.$el);
},
click() {
if (typeof this.onClick === 'function') {
this.onClick();
}
},
close() {
this.closed = true;
if (typeof this.onClose === 'function') {
......
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