<!--
 * @Author: lixg lixg@dongwu-inc.com
 * @Date: 2023-01-15 14:57:30
 * @LastEditors: lixg lixg@dongwu-inc.com
 * @LastEditTime: 2023-01-15 15:16:42
 * @FilePath: /stu_h5/src/components/FileTypeImg.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <img
    class="file"
    :style="style"
    :src="
      {
        pdf,
        doc: word,
        ppt,
        zip,
        excel,
        xlsx: excel,
        xls: excel,
        rar,
        book,
        md,
        docx: word,
        png,
      }[filePath.split('.').slice(-1)] || book
    "
  />
</template>
<script setup>
import rar from "@/assets/image/file/rar.png";
import excel from "@/assets/image/file/excel.png";
import md from "@/assets/image/file/md.png";
import pdf from "@/assets/image/file/pdf.png";
import ppt from "@/assets/image/file/ppt.png";
import word from "@/assets/image/file/word.png";
import zip from "@/assets/image/file/zip.png";
import book from "@/assets/image/file/book.png";
import { defineProps, ref } from "vue";

const { modelValue = "", style } = defineProps({
  modelValue: String,
  style: {
    type: Object,
    default: {},
  },
});
const filePath = ref(modelValue);
console.log("filePath", filePath);
</script>
<style lang="scss">
.file {
  width: 22px;
  height: 26px;
}
</style>