Merge pull request #2783 from SergioCrisostomo/add-clickoutside-event

New feature: add "clickoutside" event emitter to dropdown
This commit is contained in:
Aresn 2018-01-15 18:24:29 +08:00 committed by GitHub
commit 9c1b5c1c32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
<template>
<div
:class="[prefixCls]"
v-clickoutside="handleClose"
v-clickoutside="onClickoutside"
@mouseenter="handleMouseenter"
@mouseleave="handleMouseleave">
<div :class="[prefixCls + '-rel']" ref="reference" @click="handleClick"><slot></slot></div>
@ -111,6 +111,10 @@
}, 150);
}
},
onClickoutside (e) {
this.handleClose();
if (this.currentVisible) this.$emit('on-clickoutside', e);
},
handleClose () {
if (this.trigger === 'custom') return false;
if (this.trigger !== 'click') {