1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| request({a:1}).then(response => { let blob = new Blob([response], { type: 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) if (window.navigator.msSaveOrOpenBlob) { navigator.msSaveBlob(blob) } else { const link = document.createElement('a') link.style.display = 'none' link.href = URL.createObjectURL(blob) link.download = 'demo.xls' document.body.appendChild(link) link.click() document.body.removeChild(link) } })
|