Notification: add onClick handler

pull/2944/merge
Alexandre Mouillard 2017-04-14 16:14:14 +02:00 committed by 杨奕
parent bcbd94f460
commit d51f08870d
1 changed files with 10 additions and 2 deletions

View File

@ -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') {