async down_1() {
const {
data: res
} = await this.$http.get(
"5003/sys/file/download?originalName=" +
this.originalName_1 +
"&" +
"remoteFileName=" +
this.remoteFileName_1,
{ responseType: "blob" }
);
console.log(res);
let data = res;
if (!data) {
this.$message.error("下载失败,解析数据为空!");
return;
}
const datetime = Date.now();
// 创建一个新的url,此url指向新建的Blob对象
let url = window.URL.createObjectURL(new Blob([data]));
// 创建a标签,并隐藏改a标签
let link = document.createElement("a");
link.style.display = "none";
// a标签的href属性指定下载链接
link.href = url;
//setAttribute() 方法添加指定的属性,并为其赋指定的值。
let fileName = datetime + ".png";
link.setAttribute("download", fileName);
document.body.appendChild(link);
link.click();
this.$message.success("导出成功");
}