Compare commits
No commits in common. "77cd8fddfde86ed1d5b3f2d662e011234f8ef586" and "3d6ad2475baa53875f100cbb1fd9bbd52374fc67" have entirely different histories.
77cd8fddfd
...
3d6ad2475b
@ -109,14 +109,7 @@ const handleDownload = (url) => {
|
|||||||
// 创建一个隐藏的a元素
|
// 创建一个隐藏的a元素
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
link.href = url;
|
link.href = url;
|
||||||
|
link.download = url.split("/").pop(); // 从URL提取文件名
|
||||||
// 修复文件名提取逻辑
|
|
||||||
let fileName = url.split("/").pop();
|
|
||||||
// 移除可能存在的查询参数
|
|
||||||
if (fileName.includes("?") || fileName.includes("_t=")) {
|
|
||||||
fileName = fileName.split(/[?_]/)[0];
|
|
||||||
}
|
|
||||||
link.download = fileName;
|
|
||||||
link.target = "_blank";
|
link.target = "_blank";
|
||||||
|
|
||||||
// 对于移动设备,我们需要特殊处理
|
// 对于移动设备,我们需要特殊处理
|
||||||
|
Loading…
Reference in New Issue
Block a user