mirror of
https://github.com/luxfhe/example-blind-auction.git
synced 2026-10-30 18:13:37 +00:00
22 lines
492 B
JavaScript
22 lines
492 B
JavaScript
import { defineNuxtPlugin } from '#app'
|
|
import { Tooltip } from 'bootstrap'
|
|
|
|
export default defineNuxtPlugin(nuxtApp => {
|
|
nuxtApp.vueApp.directive('tooltip', {
|
|
mounted(el, binding) {
|
|
new Tooltip(el, {
|
|
html: true,
|
|
title: binding.value,
|
|
placement: binding.arg || 'top',
|
|
trigger: 'hover focus',
|
|
})
|
|
},
|
|
beforeUnmount(el) {
|
|
const tooltip = Tooltip.getInstance(el)
|
|
if (tooltip) {
|
|
tooltip.dispose()
|
|
}
|
|
},
|
|
})
|
|
})
|