-
-
Save rscoopcur/7730630d93c5a6d1a902d31727b9fefb to your computer and use it in GitHub Desktop.
How to create Popover component (Vue3, script setup and BS5)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <slot /> | |
| </template> | |
| <script setup> | |
| import { Popover } from 'bootstrap' | |
| import { onMounted } from 'vue' | |
| import { useSlots } from 'vue'; | |
| const slots = useSlots(); | |
| const props = defineProps({ | |
| content: { | |
| required: false, | |
| default: '', | |
| }, | |
| title: { | |
| default: 'My Popover', | |
| }, | |
| trigger: { | |
| default: 'hover', | |
| }, | |
| delay: { | |
| default: 0, | |
| }, | |
| html: { | |
| default: false, | |
| }, | |
| }) | |
| onMounted(() => { | |
| const ele = slots.default()[0].el | |
| new Popover(ele, props) | |
| }) | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment