<template>
  <el-dialog
    v-if="visible"
    :visible.sync="visible"
    :title="title"
    :fullscreen="true"
    append-to-body
    custom-class="base-dialog-wrapper"
    @close="handleClose"
  >
    <div class="base-modal-body" style="border: 2px solid #ccc; padding: 10px">
      <PreviewFile v-if="visible" :file-path="path" :file-type="type" />
    </div>
  </el-dialog>
</template>
<script>
import PreviewFile from "@/components/PreviewFile";
export default {
  name: "preview",
  components: { PreviewFile },
  data() {
    return {
      visible: false,
      path: null,
      type: null,
      title: null,
    };
  },
  methods: {
    open(path, type, title) {
      this.path = path;
      this.type = type;
      this.title = title;
      this.visible = true;
    },
    handleClose() {
      this.$emit("closed");
    },
  },
};
</script>