refactor: 移动 iframe 到 @vben/common-ui

This commit is contained in:
xingyu4j
2025-09-10 11:55:09 +08:00
parent b3a4a91a25
commit 4cb1ecfb1c
17 changed files with 13 additions and 64 deletions

View File

@@ -0,0 +1,38 @@
<script setup lang="ts">
import { onMounted, ref } from 'vue';
interface IFrameProps {
/** iframe 的源地址 */
src: string;
}
const props = defineProps<IFrameProps>();
const loading = ref(true);
const height = ref('');
const frameRef = ref<HTMLElement | null>(null);
function init() {
height.value = `${document.documentElement.clientHeight - 94.5}px`;
loading.value = false;
}
onMounted(() => {
setTimeout(() => {
init();
}, 300);
});
// TODO @芋艿:优化:未来使用 vben 自带的内链实现
</script>
<template>
<div v-loading="loading" :style="`height:${height}`">
<iframe
ref="frameRef"
:src="props.src"
style="width: 100%; height: 100%"
frameborder="no"
scrolling="auto"
></iframe>
</div>
</template>

View File

@@ -0,0 +1 @@
export { default as IFrame } from './iframe.vue';

View File

@@ -5,6 +5,7 @@ export * from './count-to';
export * from './doc-alert';
export * from './ellipsis-text';
export * from './icon-picker';
export * from './iframe';
export * from './json-viewer';
export * from './loading';
export * from './page';