Commit 526a142cac0614619804477a8b73a2a0f9c834d0
1 parent
3537176f
add click outside event emitter to dropdown
Showing
1 changed file
with
5 additions
and
1 deletions
Show diff stats
src/components/dropdown/dropdown.vue
| 1 | 1 | <template> |
| 2 | 2 | <div |
| 3 | 3 | :class="[prefixCls]" |
| 4 | - v-clickoutside="handleClose" | |
| 4 | + v-clickoutside="onClickoutside" | |
| 5 | 5 | @mouseenter="handleMouseenter" |
| 6 | 6 | @mouseleave="handleMouseleave"> |
| 7 | 7 | <div :class="[prefixCls + '-rel']" ref="reference" @click="handleClick"><slot></slot></div> |
| ... | ... | @@ -111,6 +111,10 @@ |
| 111 | 111 | }, 150); |
| 112 | 112 | } |
| 113 | 113 | }, |
| 114 | + onClickoutside (e) { | |
| 115 | + this.handleClose(); | |
| 116 | + if (this.currentVisible) this.$emit('on-clickoutside', e); | |
| 117 | + }, | |
| 114 | 118 | handleClose () { |
| 115 | 119 | if (this.trigger === 'custom') return false; |
| 116 | 120 | if (this.trigger !== 'click') { | ... | ... |