index.vue 708 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <div v-loading="loading" :style="'height:' + height">
  3. <iframe :src="url" frameborder="no" style="width: 100%; height: 100%" scrolling="auto" />
  4. </div>
  5. </template>
  6. <script setup lang="ts">
  7. import { ref, computed, onMounted } from 'vue'
  8. interface IFrameProps {
  9. src: string
  10. }
  11. const props = withDefaults(defineProps<IFrameProps>(), {
  12. src: ''
  13. })
  14. const height = ref(document.documentElement.clientHeight - 94.5 + 'px;')
  15. const loading = ref(true)
  16. const url = computed(() => props.src)
  17. onMounted(() => {
  18. setTimeout(() => {
  19. loading.value = false
  20. }, 300)
  21. window.onresize = function temp() {
  22. height.value = document.documentElement.clientHeight - 94.5 + 'px;'
  23. }
  24. })
  25. </script>