<template>
  <i-frame :src="openUrl"
    id="jimuReportFrame"
    ref="myIframe"
    @load="load"></i-frame>
</template>
<script>
// 报表设计器
import { getToken } from '@/utils/auth'
import iFrame from '@/components/iFrame/index'
export default {
  name: "Jimu",
  components: { iFrame },
  data() {
    return {
      // 这里写暴露的统一的网关地址
      openUrl: "http://192.168.100.39:8080/report/jmreport/list?token=" + getToken(),
    };
  },
  mounted: function () {

  },
  methods: {
    load() {
      setTimeout(() => {
        const iframe = this.$refs.myIframe;
        console.log(iframe.contentDocument)
        const iframeBody = iframe.body;
        console.log(iframeBody)
      }, 5000)

      // 现在你可以操作 iframeBody 中的标签了
      // const h1Element = iframeBody.querySelector('h1');
      // console.log(h1Element.textContent); // 输出 h1 标签的文本内容
    }
  }
};
</script>

<style lang="scss">
#jimuReportFrame {
  width: 100%;
  min-height: calc(100vh - 50px) !important;
  // height: calc(100vh + 50px) !important;
  margin-top: -50px;
}
</style>