fix(popover): will not vanish when only scroll wheel

This commit is contained in:
07akioni 2019-08-12 17:06:35 +08:00
parent 617b6d55e9
commit f3d4ad784f

View File

@ -8,6 +8,7 @@
class="n-popover__activator"
@click="handleActivatorClick"
@mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeavePopover"
>
<slot name="activator" />
</div>
@ -39,6 +40,7 @@
}"
:style="style"
@mouseenter="handleMouseEnter"
@mouseleave="handleMouseLeavePopover"
>
<div
v-if="arrow"
@ -160,7 +162,6 @@ export default {
},
handleMouseEnter () {
if (this.trigger === 'hover') {
console.log(this.delay)
if (this.vanishTimerId) {
window.clearTimeout(this.vanishTimerId)
this.vanishTimerId = null
@ -181,8 +182,7 @@ export default {
this.deactivate()
clickoutsideDelegate.unregisterHandler(this.handleClickOutsidePopover)
},
handleMoveOutsidePopover (e) {
console.log('move out side')
hidePopover () {
if (this.vanishTimerId !== null) {
window.clearTimeout(this.vanishTimerId)
this.vanishTimerId = null
@ -196,6 +196,16 @@ export default {
this.deactivate()
}, this.duration)
},
handleMouseLeavePopover (e) {
if (this.trigger === 'hover') {
this.hidePopover()
}
},
handleMoveOutsidePopover (e) {
if (this.trigger === 'hover') {
this.hidePopover()
}
},
handleActivatorClick () {
if (this.trigger === 'click') {
if (!this.active) {