Skip to content

Commit

Permalink
update event vue 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ninamarina committed Jan 17, 2025
1 parent 53d4938 commit 92beb87
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 12 deletions.
15 changes: 6 additions & 9 deletions packages/dialtone-vue2/components/hovercard/hovercard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,14 @@
@opened="(e) => ($emit('opened', e))"
@mouseenter-popover="onMouseEnter"
@mouseleave-popover="onMouseLeave"
@mouseenter-popover-anchor="onMouseEnter"
@mouseleave-popover-anchor="onMouseLeave"
>
<template #anchor="{ attrs }">
<div
@mouseenter-popover="onMouseEnter"
@mouseleave-popover="onMouseLeave"
>
<slot
name="anchor"
v-bind="attrs"
/>
</div>
<slot
name="anchor"
v-bind="attrs"
/>
</template>
<template #content>
<slot name="content" />
Expand Down
42 changes: 39 additions & 3 deletions packages/dialtone-vue2/components/popover/popover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
:tabindex="contentTabindex"
appear
v-on="popoverListeners"
@mouseenter="onMouseEnter"
@mouseleave="onMouseLeave"
@mouseenter="onMouseEnterAnchor"
@mouseleave="onMouseLeaveAnchor"
>
<popover-header-footer
v-if="$slots.headerContent || showCloseButton"
Expand Down Expand Up @@ -520,7 +520,35 @@ export default {
* @event update:opened
* @type {Boolean | Array}
*/
'update:open',
'opened',

/**
* Emitted when the mouse enters the popover
*
* @event mouseenter-popover
*/
'mouseenter-popover',

/**
* Emitted when the mouse leaves the popover
*
* @event mouseleave-popover
*/
'mouseleave-popover',

/**
* Emitted when the mouse enters the popover anchor
*
* @event mouseenter-popover-anchor
*/
'mouseenter-popover-anchor',

/**
* Emitted when the mouse leaves the popover anchor
*
* @event mouseleave-popover-anchor
*/
'mouseleave-popover-anchor',
],

data () {
Expand Down Expand Up @@ -988,6 +1016,14 @@ export default {
onMouseLeave () {
this.$emit('mouseleave-popover');
},

onMouseEnterAnchor () {
this.$emit('mouseenter-popover-anchor');
},

onMouseLeaveAnchor () {
this.$emit('mouseleave-popover-anchor');
},
},
};
</script>

0 comments on commit 92beb87

Please sign in to comment.