提交 | 用户 | 时间
|
820397
|
1 |
<script lang="ts" setup> |
H |
2 |
import { propTypes } from '@/utils/propTypes' |
|
3 |
|
|
4 |
defineOptions({ name: 'IFrame' }) |
|
5 |
|
|
6 |
const props = defineProps({ |
|
7 |
src: propTypes.string.def('') |
|
8 |
}) |
|
9 |
const loading = ref(true) |
|
10 |
const height = ref('') |
|
11 |
const frameRef = ref<HTMLElement | null>(null) |
|
12 |
const init = () => { |
|
13 |
height.value = document.documentElement.clientHeight - 94.5 + 'px' |
|
14 |
loading.value = false |
|
15 |
} |
|
16 |
onMounted(() => { |
|
17 |
setTimeout(() => { |
|
18 |
init() |
|
19 |
}, 300) |
|
20 |
}) |
|
21 |
</script> |
|
22 |
<template> |
|
23 |
<div v-loading="loading" :style="'height:' + height"> |
|
24 |
<iframe |
|
25 |
ref="frameRef" |
|
26 |
:src="props.src" |
|
27 |
frameborder="no" |
|
28 |
scrolling="auto" |
|
29 |
style="width: 100%; height: 100%" |
|
30 |
></iframe> |
|
31 |
</div> |
|
32 |
</template> |