Skip to content

Instantly share code, notes, and snippets.

@rscoopcur
Forked from jannunen/Popover.vue
Created March 11, 2024 18:51
Show Gist options
  • Select an option

  • Save rscoopcur/7730630d93c5a6d1a902d31727b9fefb to your computer and use it in GitHub Desktop.

Select an option

Save rscoopcur/7730630d93c5a6d1a902d31727b9fefb to your computer and use it in GitHub Desktop.
How to create Popover component (Vue3, script setup and BS5)
<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