fix(EntityRow&FileRow): window.location.assign(url);

This commit is contained in:
WittF 2025-06-22 19:00:53 +08:00
parent cca800afa8
commit 01a29b64e3
2 changed files with 4 additions and 13 deletions

View File

@ -50,8 +50,8 @@ const EntityRow = ({
dispatch(getEntityUrl(entity?.id ?? 0))
.then((url) => {
// window.location.assign(url);
window.open(url, "_blank");
// 直接下载文件
window.location.assign(url);
})
.finally(() => {
setOpenLoading(false);

View File

@ -89,17 +89,8 @@ const FileRow = ({
// 可预览文件:新窗口打开预览,窗口保持显示预览内容
window.open(url, "_blank");
} else {
// PlanA:
// 当前窗口下载(不跳转页面,直接下载链接)
// window.location.assign(url);
// PlanB:
// 在新窗口打开下载链接
// - 下载成功:浏览器自动关闭下载窗口
// - 下载失败:窗口保持打开显示错误信息
window.open(url, "_blank");
// 下载文件:当前窗口下载(不跳转页面,直接下载链接)
window.location.assign(url);
}
})
.finally(() => {