feat: add iframe support for URL preview in AutoProbeResultsContainer

This commit is contained in:
Marvin Zhang
2025-05-16 17:17:34 +08:00
parent 6705ce2ded
commit 5d837cca7e
2 changed files with 12 additions and 11 deletions

View File

@@ -12,10 +12,12 @@ const props = defineProps<{
data?: PageData | PageData[];
fields?: AutoProbeNavItem[];
activeFieldName?: string;
url?: string;
}>();
// Refs
const resultsContainerRef = ref<HTMLElement | null>(null);
const iframeRef = ref<HTMLIFrameElement | null>(null);
// States
const activeTabName = ref<string | undefined>(TAB_NAME_RESULTS);
@@ -151,7 +153,9 @@ defineOptions({ name: 'ClAutoProbeResultsContainer' });
hide-footer
/>
</div>
<div class="output" v-else-if="activeTabName === TAB_NAME_PREVIEW"></div>
<div class="preview" v-else-if="activeTabName === TAB_NAME_PREVIEW">
<iframe v-if="url" ref="iframeRef" :src="url" />
</div>
</div>
</template>
@@ -210,18 +214,14 @@ defineOptions({ name: 'ClAutoProbeResultsContainer' });
}
}
.output {
padding: 10px;
.preview {
overflow: hidden;
height: calc(100% - 41px);
overflow: auto;
white-space: pre-wrap;
pre {
margin: 0;
font-size: 14px;
line-height: 1.5;
color: var(--cl-text-color);
white-space: pre-wrap;
iframe {
width: 100%;
height: 100%;
border: none;
}
}
}

View File

@@ -260,6 +260,7 @@ defineOptions({ name: 'ClAutoProbeDetailTabPatterns' });
:data="resultsData"
:fields="resultsFields"
:active-field-name="resultsActiveField?.name"
:url="form.url"
@size-change="onSizeChange"
/>
</div>