Skip to content
This repository was archived by the owner on Mar 27, 2025. It is now read-only.

Commit a7d9718

Browse files
feat(BTooltip): expose hide, show and toggle methods from BPopover
1 parent 591dea0 commit a7d9718

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,26 @@
11
<template>
2-
<BPopover tooltip>
2+
<BPopover ref="popover" tooltip>
33
<template v-for="(_, name) in $slots" #[name]="slotData">
44
<slot :name="name" v-bind="slotData" />
55
</template>
66
</BPopover>
77
</template>
88

99
<script setup lang="ts">
10+
import {ref} from 'vue'
1011
import BPopover from './BPopover.vue'
12+
13+
const popover = ref()
14+
15+
/* Extend the hide, show and toggle functions of the BPopover component
16+
to allow the user to programmatically control the tooltip. */
17+
const hideFn = (event: Event) => popover.value.hideFn(event)
18+
const show = () => popover.value.show()
19+
const toggle = (event: Event) => popover.value.toggle(event)
20+
21+
defineExpose({
22+
hideFn,
23+
show,
24+
toggle,
25+
})
1126
</script>

0 commit comments

Comments
 (0)