iframe adaptive height

Based on business needs, I wrote a common iframe component:
1. Height adaptive (manually obtain the content height in the onload event and give it to the iframe)
2. When the window is resized, the height changes in response to the height of the content inside the iframe.

<template>
  <div class="iframe-block-wrap">
    <iframe
      v-if="iframeId && iframeData"
      :id="iframeId"
      :srcdoc="iframeData"
      :frameborder="frameborder"
      :scrolling="scrolling"
      :width="width"
      @load="onloadFn"
    ></iframe>
  </div>
</template>

<script lang="ts">
export default {
   
    
    
  name: 'IframeBlock',
  props: {
   
    
    
    data:

Guess you like

Origin blog.csdn.net/be_strong_web/article/details/121851634