天天看点

2021-09-03 vue+elementui导出表格数据为excel文件

async exportData(){
      if (this.multipleSelection && this.multipleSelection.length == 0) {
        this.$message("未勾选要导出的数据");
        return;
      }

      let params = {
        uuids: this.uuidsString,
        config: true
      };
      exportPreResultExcel(params).then(res => {
        const fileName  = '预审结果列表.xlsx';
        const link = document.createElement('a');
        let blob = new Blob([res], {type: 'application/vnd.ms-excel'});
        link.download = fileName;
        link.style.display = 'none';
        link.href = URL.createObjectURL(blob);
        document.body.appendChild(link);
        link.click();
        URL.revokeObjectURL(link.href);
        document.body.removeChild(link);
      });
    }
  },
           

继续阅读