download(url, params = {}, fileName = '') {
return axios({
url: url,
method: 'post',
params,
responseType: "arraybuffer"
}).then(res => {
const content = res;
const blob = new Blob([content]);
if ('msSaveOrOpenBlob' in navigator) {
window.navigator.msSaveOrOpenBlob(blob, fileName);
return;
}
const elink = document.createElement("a");
elink.download = fileName;
elink.style.display = "none";
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
URL.revokeObjectURL(elink.href);
document.body.removeChild(elink);
});
}