backend/yudao-ui-admin-vue3/src/components/IFrame/src/IFrame.vue
2022-11-23 14:37:35 +08:00

33 lines
739 B
Vue

<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { propTypes } from '@/utils/propTypes'
const props = defineProps({
src: propTypes.string.def('')
})
const loading = ref(true)
const height = ref('')
const frameRef = ref<HTMLElement | null>(null)
const init = () => {
height.value = document.documentElement.clientHeight - 94.5 + 'px'
loading.value = false
}
onMounted(() => {
setTimeout(() => {
init()
}, 300)
})
</script>
<template>
<div v-loading="loading" :style="'height:' + height">
<iframe
:src="props.src"
style="width: 100%; height: 100%"
frameborder="no"
scrolling="auto"
ref="frameRef"
></iframe>
</div>
</template>
<script lang="less" scoped></script>