【新增】前端代码第一次提交
This commit is contained in:
3
src/components/IFrame/index.ts
Normal file
3
src/components/IFrame/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
import IFrame from './src/IFrame.vue'
|
||||
|
||||
export { IFrame }
|
||||
47
src/components/IFrame/src/IFrame.vue
Normal file
47
src/components/IFrame/src/IFrame.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<script lang="ts" setup>
|
||||
import { propTypes } from '@/utils/propTypes'
|
||||
|
||||
defineOptions({ name: 'IFrame' })
|
||||
|
||||
const props = defineProps({
|
||||
src: propTypes.string.def('')
|
||||
})
|
||||
const loading = ref(true)
|
||||
const frameRef = ref<HTMLElement | null>(null)
|
||||
const init = () => {
|
||||
nextTick(() => {
|
||||
loading.value = true
|
||||
if (!frameRef.value) return
|
||||
frameRef.value.onload = () => {
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
onMounted(() => {
|
||||
init()
|
||||
})
|
||||
watch(
|
||||
() => props.src,
|
||||
() => {
|
||||
init()
|
||||
}
|
||||
)
|
||||
</script>
|
||||
<template>
|
||||
<div
|
||||
v-loading="loading"
|
||||
class="w-full h-[calc(100vh-var(--top-tool-height)-var(--tags-view-height)-var(--app-content-padding)-var(--app-content-padding)-2px)]"
|
||||
>
|
||||
<iframe
|
||||
ref="frameRef"
|
||||
:src="props.src"
|
||||
frameborder="0"
|
||||
scrolling="auto"
|
||||
height="100%"
|
||||
width="100%"
|
||||
allowfullscreen="true"
|
||||
webkitallowfullscreen="true"
|
||||
mozallowfullscreen="true"
|
||||
></iframe>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user