<template>


  <el-dialog class="common-dialog" :fullscreen='isfullscreen' :title="title" :modal="false" top="2vh" :visible.sync="diaShow" @close="coloseDia"
    :width="width">
    <div slot="title">
      <span class="el-dialog__title">{{title}}</span>
      <slot name="searchtype"></slot>
    </div>

    <div class="dialogConcent" :style="{height:wheight+'px'}">
      <iframe id="iframeWin" :src="baseUrl+url" frameborder="0" scrolling="auto" align="center" class="iframeWeb">
      </iframe>
    </div>

    <div slot="footer" class="dialog-footer">
      <div>
        <el-button size="small" @click="coloseDia">关闭</el-button>

      </div>
      <slot name="footerbtn"></slot>
    </div>
  </el-dialog>

</template>

<script>
  export default {
    props: {
      title: {
        type: String,
        default: "文件预览"
      },
      width: {
        type: String,
        default: "60%"
      },
      isShow: {
        type: Boolean,
        default: () => {
          return false
        }
      },
      type: {
        type: String,
        default: "showinfo"
      },
    },
    data() {
      return {
        diaShow: this.isShow,
        isfullscreen:false,
        url:'',
        baseUrl: "http://192.168.60.24:8012/onlinePreview?url=",
        wheight: "",
        form:{
          show:''
        }
      }
    },
    watch: {
      isShow(val) {
        this.diaShow = this.isShow;
      },

    },
    methods: {

      coloseDia() {
        // this.url = ""
        this.diaShow = false
        this.url = ''
        this.$emit('update:isShow', false)
        this.$emit('resetform')
      }
    }
  }
</script>

<style scoped>
  /deep/ .show{
    flex-basis: 100%;
  }
  .dialogConcent {
    overflow-y: hidden;
  }

  .iframeWeb {
    text-align: center;
    border: none;
    display: block;
    height: 100vh;
    width: 100%;
  }
</style>
