From c0b0cc9f7ecd0bc3d63b2d9fcc4180ac8c4c2cc9 Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Fri, 16 May 2025 18:17:07 +0800 Subject: [PATCH] feat: improve iframe loading state management and enhance styling in AutoProbeResultsContainer --- .../autoprobe/AutoProbeResultsContainer.vue | 41 +++++++++++++++---- .../tabs/AutoProbeDetailTabPatterns.vue | 3 ++ 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/frontend/crawlab-ui/src/components/core/autoprobe/AutoProbeResultsContainer.vue b/frontend/crawlab-ui/src/components/core/autoprobe/AutoProbeResultsContainer.vue index 65301ed8..f2aeafd1 100644 --- a/frontend/crawlab-ui/src/components/core/autoprobe/AutoProbeResultsContainer.vue +++ b/frontend/crawlab-ui/src/components/core/autoprobe/AutoProbeResultsContainer.vue @@ -18,10 +18,10 @@ const props = defineProps<{ // Refs const resultsContainerRef = ref(null); const iframeRef = ref(null); +const iframeLoading = ref(true); // States const activeTabName = ref(TAB_NAME_RESULTS); - const resultsVisible = ref(true); const resultsTabItems = computed(() => [ @@ -85,6 +85,11 @@ const onTabSelect = (id: string) => { if (!resultsVisible.value) { resultsVisible.value = true; } + + // Reset iframe loading state when switching to preview tab + if (id === TAB_NAME_PREVIEW) { + iframeLoading.value = true; + } }; const toggleResults = () => { @@ -94,6 +99,10 @@ const toggleResults = () => { } }; +const onIframeLoad = () => { + iframeLoading.value = false; +}; + // Resize handler const heightKey = 'autoprobe.results.containerHeight'; const onSizeChange = (size: number) => { @@ -154,12 +163,16 @@ defineOptions({ name: 'ClAutoProbeResultsContainer' }); />
-