<a-upload-dragger
    name="file"
    accept=".xls,.xlsx"
    :multiple="true"
    action=""
    :customRequest="importData"
    @change="handleChange"// Change the upload status
    >
   <p class="ant-upload-drag-icon">
       <img src=".. /.. /.. /.. /assets/image/upfile_icon.png" alt="" />
   </p>
       <p class="ant-upload-text" style=Color: rgba(205, 240, 243, 0.85)">Click or drag the file here to upload</p>
       <p class="ant-upload-hint" style=Color: rgba(205, 240, 243, 0.45)">Supported extension:.xlsx or.xls</p>
</a-upload-dragger>
Copy the code
 methods:{
    handleChange(info){
      info.file.status = 'done'
    }
        // Data import
    importData(item) {
      if (item.file.name === undefined) {
        this.$message({ type: "warning".message: "Please select file" });
        return;
      }
      const extension = item.file.name.substring(
        item.file.name.lastIndexOf(".") + 1
      );
      const size = item.file.size / 1024 / 1024;
      this.filesize = size;
      if(extension ! = ="xlsx"&& extension ! = ="xls") {
        this.$message({ type: "warning".message: "Please select XLSX or XLS file" });
        return;
      }
      if (size > 3) {
        this.$message({ type: "warning".message: "Files must not be larger than 3M" });
        return; }}},Copy the code