0%
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| getDownloadFile(sendMessage, url) { axios({ url: url, method: 'post', data: sendMessage, responseType: 'blob', headers: { 'Content-Type': 'application/json' } }) .then(res => { const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) const fileName = decodeURIComponent(res.headers['content-disposition'].split('=')[1]) const linkNode = document.createElement('a') linkNode.download = fileName linkNode.style.display = 'none' linkNode.href = URL.createObjectURL(blob) document.body.appendChild(linkNode) linkNode.click() URL.revokeObjectURL(linkNode.href) document.body.removeChild(linkNode) }) }
|