feat: 修复下载文件内容错误问题

This commit is contained in:
v_wnxinfeng
2025-09-16 14:26:50 +08:00
committed by lyingbug
parent 4005aa3ded
commit 2e395864b9

View File

@@ -104,15 +104,19 @@ const downloadFile = () => {
downKnowledgeDetails(props.details.id)
.then((result) => {
if (result) {
if (url.value) {
URL.revokeObjectURL(url.value);
}
url.value = URL.createObjectURL(result);
down.value.click();
// const link = document.createElement("a");
// link.style.display = "none";
// link.setAttribute("href", url);
// link.setAttribute("download", props.details.title);
// link.click();
// document.body.removeChild(link);
window.URL.revokeObjectURL(url);
const link = document.createElement("a");
link.style.display = "none";
link.setAttribute("href", url.value);
link.setAttribute("download", props.details.title);
link.click();
nextTick(() => {
document.body.removeChild(link);
URL.revokeObjectURL(url.value);
})
}
})
.catch((err) => {