From 60ed367e9847524bd1672f203f50393fcb983da8 Mon Sep 17 00:00:00 2001 From: onmax Date: Thu, 10 Oct 2024 17:05:16 +0200 Subject: [PATCH] chore: show button for crypto map if the iframe cannot be loaded --- .../CryptoMapContinentSelector/index.vue | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/app/slices/CryptoMapContinentSelector/index.vue b/app/slices/CryptoMapContinentSelector/index.vue index 45219284..5849755a 100644 --- a/app/slices/CryptoMapContinentSelector/index.vue +++ b/app/slices/CryptoMapContinentSelector/index.vue @@ -64,10 +64,24 @@ watch([activeItemIndex, iframe], () => { }, { immediate: true }) const allowMapInteraction = ref(false) + +const iframeBlocked = ref(false) +const { stop } = useTimeoutFn(() => iframeBlocked.value = true, 5000) +useEventListener('load', () => { + stop() + iframeBlocked.value = false +}) + +const iframeParent = ref() +useMutationObserver(iframeParent, () => { + if (!iframe.value) { + iframeBlocked.value = true + } +}, { childList: true, subtree: true })