文件下载
download(data, fileName) {
fileName = decodeURIComponent(fileName);
console.log(data);
if (!data) {
this.$message.warning("文件下载失败")
return;
}
// let url = window.URL.createObjectURL(new Blob([data]))
let url = window.URL.createObjectURL(data.data);
let link = document.createElement("a");
link.style.display = "none";
link.href = url;
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
//用于移除创建点击事件
document.body.removeChild(link);
window.URL.revokeObjectURL(url)
},