<template>
  <div class="ifram-view" :style="iframViewStyle">
    <!-- <span>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</span> -->
    <!-- <iframe src="https://dev-mssm-liaoning.imian.org.cn/ggfw/#/firmContent/drugInfo" frameborder="0" style="width: 100%;height: 100%;"></iframe> -->
    <iframe :src="Url" frameborder="0" style="width: 100%; height: 100%" ref="iframes"></iframe>
  </div>
</template>
<script>
export default {
  data() {
    return {
      iframViewStyle: {
        height: "",
        show: true
      },
      Url: `${location.origin}/ggfw-iframe/#/productinformation?type=${this.$route.query.type
        }&flag=${this.$route.query.flag}&data=${this.$route.query.data
        }&token=${localStorage.getItem("MSSM-LIAONING__TOKEN")}&bah=${this.$route.query.bah}`,
      // Url: `http://localhost:81?type=${this.$route.query.type
      //   }&flag=${this.$route.query.flag}&data=${this.$route.query.data
      //   }&token=${localStorage.getItem("MSSM-LIAONING__TOKEN")}&bah=${this.$route.query.bah}`,
    };
  },
  methods: {},
  created() {
    this.$nextTick(() => { });
  },
  methods: {},
  mounted() {
    // this.$nextTick(() => {
    //   let dom = document.getElementsByClassName("ifram-view");
    //   let height = dom[0].getBoundingClientRect();
    //   // let windowWidth = window.innerWidth;
    //   let windowHeight = window.innerHeight;
    //   let relativeHeight = windowHeight - height.top;
    //   this.iframViewStyle.height = relativeHeight + "px";
    // });
  },
  deactivated() {
    // 当离开了缓存的页面时被调用
    this.Url = ''
    // 可以在这里做一些清理操作
  },
  activated() {
    this.$nextTick(() => {
      // this.Url = `${location.origin}/ggfw-iframe/#/productinformation?type=${this.$route.query.type
      //   }&flag=${this.$route.query.flag}&data=${this.$route.query.data
      //   }&token=${localStorage.getItem("MSSM-LIAONING__TOKEN")}&bah=${this.$route.query.bah}`
      this.Url = `http://localhost:81?type=${this.$route.query.type
        }&flag=${this.$route.query.flag}&data=${this.$route.query.data
        }&token=${localStorage.getItem("MSSM-LIAONING__TOKEN")}&bah=${this.$route.query.bah}`
      let dom = document.getElementsByClassName("ifram-view");
      let height = dom[0].getBoundingClientRect();
      // let windowWidth = window.innerWidth;
      let windowHeight = window.innerHeight;
      let relativeHeight = windowHeight - height.top;
      this.iframViewStyle.height = relativeHeight + "px";

      console.log(this.Url);
    });

  }
};
</script>
<style lang="scss" scoped>
.ifram-view {
  background-color: #fff;
}
</style>