// 单个文件下载
// 组装a标签
let elink = document.createElement("a");
// 设置下载文件名
elink.style.display = "none";
elink.href =
window.API_MODULES.public +
`/inst/data/download/part?token=${encodeURIComponent(
token
)}&partName=${encodeURIComponent(item)}`;
document.body.appendChild(elink);
elink.click();
document.body.removeChild(elink);
// 多个文件下载
let adress =
window.API_MODULES.public +
`/inst/data/download/part?token=${encodeURIComponent(
token
)}&partName=${encodeURIComponent(item)}`;
setTimeout(function() {
let frame = document.createElement("iframe");
frame.setAttribute("id", "iframe_" + i);
frame.src = adress;
document.body.appendChild(frame);
setTimeout(function() {
document.body.removeChild(frame);
}, 1000);
}, 100);
网友评论