1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| downloadInfo() { this.axiosFun() .then(function (response) { var blob = new Blob([response], { type: "application/x-xls" }); var a = document.createElement("a"); a.href = URL.createObjectURL(blob); var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*') var contentDisposition = decodeURL(res.headers['content-disposition']) var result = patt.exec(contentDisposition) var fileName = result[1] fileName = fileName.replace(/\"/g,'') a.download = fileName; a.style.display = "none"; document.body.appendChild(a); a.click(); a.remove(); }) .catch(function (err) { console.log(err); }); },
|