Commit 9c1b5c1c324a95c64b3c80da62f42d1f077cae05
Committed by
GitHub
Merge pull request #2783 from SergioCrisostomo/add-clickoutside-event
New feature: add "clickoutside" 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') { | ... | ... |