<template>
  <div class="box">
    <el-upload
      v-model:file-list="fileList"
      class="upload-demo"
      drag
      action=""
      multiple
      :on-change="handleChange"
    >
      <el-icon class="el-icon--upload"><upload-filled /></el-icon>
      <div class="el-upload__text">将文件拖拽或 <em>点击上传</em></div>
      <!-- <template #tip>
      <div class="el-upload__tip">将文件拖拽至窗口或点击上传</div>
    </template> -->
    </el-upload>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import type { UploadProps, UploadUserFile } from "element-plus";

const fileList = ref<UploadUserFile[]>([
  {
    name: "副本2025年4月份电机车运输综合报表",
    url: "https://fuss10.elemecdn.com/3/63/4e7f3a15429bfda99bce42a18cdd1jpeg.jpeg?imageMogr2/thumbnail/360x360/format/webp/quality/100",
  },
]);

const handleChange: UploadProps["onChange"] = (uploadFile, uploadFiles) => {
  fileList.value = fileList.value.slice(-3);
};
</script>

<style scoped lang="scss">
.box {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  .upload-demo {
    width: 50%;
  }
}
</style>
