<script setup lang="tsx">
import { ElMessage, ElUpload, UploadRawFile } from 'element-plus';

function beforeUpload(file: UploadRawFile) {
  // if (!file.name.endsWith('.pdf')) {
  //   if (inst != null) {
  //     inst.close();
  //   }
  //   inst = this.$message.warning('请选择pdf文件');
  //   return false;
  // }
  if (file.size > 10485760) {
    // ElMessage.closeAll();
    ElMessage.warning('文件大小不能超过10M');
    return false;
  }
}
</script>

<template>
  <h3 style="text-align: center">制度包升级</h3>
  <el-upload class="upload-demo" drag action="#" multiple :before-upload="beforeUpload">
    <Icon icon="ep:upload-filled" class="el-icon--upload" :size="67" />
    <div class="el-upload__text"> 将文件拖拽至此或 <em>点击上传</em> </div>
    <template #tip>
      <div class="el-upload__tip">提示：每个文件大小不超过10M</div>
    </template>
  </el-upload>
</template>
