add click outside event emitter to dropdown

This commit is contained in:
Sergio Crisostomo 2018-01-10 09:43:24 +01:00
parent 3537176f98
commit 526a142cac

View file

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