<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" :is-local="isLocal" />
    </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,
      isLocal: false
    };
  },
  methods: {
    open(path, type, title, isLocal) {
      this.path = path;
      this.type = type;
      this.title = title;
      this.isLocal = isLocal;
      this.visible = true;
    },
    handleClose() {
      this.$emit("closed");
    },
  },
};
</script>