下载文件
let blob = new Blob([res], { type: 'application/vnd.ms-excel;charset=utf-8' }); //application/vnd.openxmlformats-officedocument.spreadsheetml.sheet这里表示xlsx类型
let downloadElement = document.createElement('a');
let href = window.URL.createObjectURL(blob); //创建下载的链接
downloadElement.href = href;
downloadElement.download = '报表.xlsx'; //下载后文件名
document.body.appendChild(downloadElement);
downloadElement.click(); //点击下载
document.body.removeChild(downloadElement); //下载完成移除元素
window.URL.revokeObjectURL(href); //释放掉blob对象
数字三位,分割
function thousandPoints(value) {
if (!value) return 0;
return value.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,');
}