mirror of https://github.com/ElemeFE/element
Notification: add onClick handler
parent
bcbd94f460
commit
d51f08870d
|
@ -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') {
|
||||
|
|
Loading…
Reference in New Issue