前端base64转换成excel
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)
}
不积跬步,无以至千里;不积小流,无以成江海。