Newer
Older
DH_Apicture / src / components / iFrame / index.vue
@zhangqy zhangqy on 29 Nov 652 bytes first commit
  1. <template>
  2. <div v-loading="loading" :style="'height:' + height">
  3. <iframe
  4. :src="url"
  5. frameborder="no"
  6. style="width: 100%; height: 100%"
  7. scrolling="auto" />
  8. </div>
  9. </template>
  10.  
  11. <script setup>
  12. const props = defineProps({
  13. src: {
  14. type: String,
  15. required: true
  16. }
  17. })
  18.  
  19. const height = ref(document.documentElement.clientHeight - 94.5 + "px;")
  20. const loading = ref(true)
  21. const url = computed(() => props.src)
  22.  
  23. onMounted(() => {
  24. setTimeout(() => {
  25. loading.value = false;
  26. }, 300);
  27. window.onresize = function temp() {
  28. height.value = document.documentElement.clientHeight - 94.5 + "px;";
  29. };
  30. })
  31. </script>