天天看點

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);
      });
    }
  },
           

繼續閱讀