0
点赞
收藏
分享

微信扫一扫

vue 文件下载

栖桐 2023-02-22 阅读 73


this.download(api.baseURL + api.EXT_DEVICE_PRO_DATA,'设备运行数据-'+ this.extData+'.xlsx')

download(url, fileName) {
let x = new XMLHttpRequest();
x.open("GET", url, true);
x.responseType = 'blob';
x.onload = function(e) {
let url = window.URL.createObjectURL(x.response)
let a = document.createElement('a');
a.href = url
a.download = fileName
a.click()
}
x.send();
},


举报

相关推荐

0 条评论