mirror of
https://github.com/Tencent/WeKnora.git
synced 2025-11-25 19:37:45 +08:00
feat: 修复下载文件内容错误问题
This commit is contained in:
@@ -104,15 +104,19 @@ const downloadFile = () => {
|
|||||||
downKnowledgeDetails(props.details.id)
|
downKnowledgeDetails(props.details.id)
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
|
if (url.value) {
|
||||||
|
URL.revokeObjectURL(url.value);
|
||||||
|
}
|
||||||
url.value = URL.createObjectURL(result);
|
url.value = URL.createObjectURL(result);
|
||||||
down.value.click();
|
const link = document.createElement("a");
|
||||||
// const link = document.createElement("a");
|
link.style.display = "none";
|
||||||
// link.style.display = "none";
|
link.setAttribute("href", url.value);
|
||||||
// link.setAttribute("href", url);
|
link.setAttribute("download", props.details.title);
|
||||||
// link.setAttribute("download", props.details.title);
|
link.click();
|
||||||
// link.click();
|
nextTick(() => {
|
||||||
// document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
window.URL.revokeObjectURL(url);
|
URL.revokeObjectURL(url.value);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user