Ugh..
This commit is contained in:
@@ -34,9 +34,11 @@ button.copy:hover {
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { useStateStore } from "@/stores/stateStore";
|
||||||
import { nextTick, ref, watch } from "vue"
|
import { nextTick, ref, watch } from "vue"
|
||||||
|
|
||||||
const bootstrap = useNuxtApp().$bootstrap;
|
const bootstrap = useNuxtApp().$bootstrap;
|
||||||
|
const store = useStateStore();
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
code: {
|
code: {
|
||||||
@@ -89,6 +91,7 @@ watch(copied, (newValue, oldValue) => {
|
|||||||
if (newValue) {
|
if (newValue) {
|
||||||
// Ensure the DOM is updated before executing
|
// Ensure the DOM is updated before executing
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
|
store.clearBootstrap();
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
stickyTooltip.value = new bootstrap.Tooltip(stickyTooltipElement.value, { trigger: "manual" });
|
stickyTooltip.value = new bootstrap.Tooltip(stickyTooltipElement.value, { trigger: "manual" });
|
||||||
stickyTooltip.value.show();
|
stickyTooltip.value.show();
|
||||||
|
|||||||
@@ -28,7 +28,12 @@ export const useStateStore = defineStore("state", () => {
|
|||||||
tooltipList.value = [...tooltipTriggerList].map(tooltip => new bootstrap.Tooltip(tooltip));
|
tooltipList.value = [...tooltipTriggerList].map(tooltip => new bootstrap.Tooltip(tooltip));
|
||||||
};
|
};
|
||||||
|
|
||||||
return { colorMode, toggleColorMode, initBootstrap }
|
const clearBootstrap = (): void => {
|
||||||
|
popoverList.value.forEach(popover => popover.dispose());
|
||||||
|
tooltipList.value.forEach(tooltip => tooltip.dispose());
|
||||||
|
};
|
||||||
|
|
||||||
|
return { colorMode, toggleColorMode, initBootstrap, clearBootstrap }
|
||||||
}, {
|
}, {
|
||||||
persist: process.env.NODE_ENV === 'development' ? true : false,
|
persist: process.env.NODE_ENV === 'development' ? true : false,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user