diff --git a/apps/web/components/Drift/Drift.vue b/apps/web/components/Drift/Drift.vue index b4fe8a44c..841e5b657 100644 --- a/apps/web/components/Drift/Drift.vue +++ b/apps/web/components/Drift/Drift.vue @@ -15,6 +15,10 @@ onMounted(() => { let demoTrigger = document.querySelector(`.demo-trigger-${index}`) as HTMLElement; let paneContainer = document.querySelector('.drift-zoom-image') as HTMLElement; + if (!demoTrigger || !paneContainer) { + return; + } + drift = new Drift(demoTrigger, { paneContainer: paneContainer, containInline: true, @@ -25,6 +29,20 @@ onMounted(() => { }); }); +onBeforeRouteUpdate(() => { + if (drift) { + drift.destroy(); + drift = null; + } +}); + +onBeforeRouteLeave(() => { + if (drift) { + drift.destroy(); + drift = null; + } +}); + onUnmounted(() => { if (drift) { drift.destroy(); diff --git a/apps/web/components/ZoomableImage/ZoomableImage.vue b/apps/web/components/ZoomableImage/ZoomableImage.vue index 12211363c..3c1f3c280 100644 --- a/apps/web/components/ZoomableImage/ZoomableImage.vue +++ b/apps/web/components/ZoomableImage/ZoomableImage.vue @@ -10,7 +10,7 @@ {{ $t('double-tap-zoom') }} - +