downloadFile(url, label) {
axios
.get(url, { responseType: "blob" })
.then((response) => {
const blob = new Blob([response.data]);
const link = document.createElement("a");
link.href = URL.createObjectURL(blob);
link.download = label;
link.click();
URL.revokeObjectURL(link.href);
})
.catch(console.error);
},
this.$api.post(
"/cdn/cdnDownload",
{
fid: type === 2 ? item.key : item.id,
t: this.$utils.getCookie(this.$glb.fmCookieName),
},
(res) => {
if (res.code === 200) {
console.log(res.data.cdnUrl, "res.data.cdnUrl");
this.$utils.downloadFile(res.data.cdnUrl, res.data.name);
} else {
this.$notify.warning({
title: "提示",
message: res.msg,
});
}
},
3
);
网友评论