baseToExcel(baseStr, fileName) {
var raw = window.atob(baseStr);
var uInt8Array = new Uint8Array(raw.length);
for (var i = 0; i < raw.length; i++) {
uInt8Array[i] = raw.charCodeAt(i);
}
const link = document.createElement("a");
const blob = new Blob([uInt8Array], {
type: 'application/vnd.ms-excel'
})
link.style.display = 'none';
link.href = URL.createObjectURL(blob);
link.setAttribute('download', fileName);
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
标签:转换成,base64,excel,uInt8Array,raw,link,var,document
From: https://www.cnblogs.com/lovedaodao/p/18102192