2 个回答
新手上路,请多包涵

宽高100% 相对定位(position:absolute)设置top,left,bottom:0

<script>
import $ from "jquery";
export default {
  mounted() {
      function reinitIframe(){
          var iframe = document.getElementById("test");
          try{
              var bHeight = iframe.contentWindow.document.body.scrollHeight;
              var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
              var height = Math.min(bHeight, dHeight);
              iframe.height = height;
             /* console.log(iframe.contentWindow);
              console.log(bHeight,dHeight);*/
          }catch (ex){}
      };
      setInterval(reinitIframe,100);
  }
};
</script>

我这样写的,希望对你有帮助

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题