原生js 导出excel
程序员文章站
2024-03-20 17:14:58
...
var timestamp = new Date().getTime();
var xmlResquest = new XMLHttpRequest();
xmlResquest.open('POST', _this.hnss + `/sheshui/yjjc/exportCompanyList?pageNum=${_this.page}&pageSize=${_this.pageSize}`);
xmlResquest.setRequestHeader('Content-type', 'application/json');
xmlResquest.responseType = 'blob';
xmlResquest.onload = function (oEvent) {
var content = xmlResquest.response;
var elink = document.createElement('a');
elink.download = '企业详情导出模板' + timestamp + '.xlsx';
elink.style.display = 'none';
var blob = new Blob([content]);
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
};
xmlResquest.send();
```Ï
上一篇: 二分查找法(JAVA版)
下一篇: iOS学习之Map,定位,标记位置的使用