ldc-wenn-dann-mit-respekt/resources/ts/modules/bsTooltips.ts
2023-05-03 14:30:21 +02:00

36 lines
1.1 KiB
TypeScript

import type * as bootstrap from "bootstrap";
/** ! Ignore here because there is no good TS vue mixin implementation at this time */
export default {
data(): {
_tooltips: Array<bootstrap.Tooltip>;
} {
return {
_tooltips: [],
};
},
methods: {
initTooltips() {
// @ts-ignore
if (this._tooltips) {
// @ts-ignore
this._tooltips.forEach((tooltip) => {
tooltip.disable();
tooltip.hide();
});
}
// @ts-ignore
this._tooltips = [].slice
.call(document.querySelectorAll("[data-bs-toggle=\"tooltip\"]"))
.map(function (tooltipTriggerEl) {
return new window.bootstrap.Tooltip(tooltipTriggerEl, {
customClass: "large-tooltip",
delay: {
show: 1250,
hide: 0,
},
});
});
},
},
};