<a onclick="downloadFile('url','name')" style="color:#063899" >
<div class="upload_data">${file.name!}
</a>
// 下载文件
function downloadFile(fileRealPath, fileName) {
let link =document.createElement("a");
let url = fileRealPath; //codeIMG 要下载的路径
// 这里是将url转成blob地址,
fetch(url)
.then((res) => res.blob())
.then((blob) => {
// 将链接地址字符内容转变成blob地址
link.href =window.URL.createObjectURL(blob);
link.download = fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link)
window.URL.revokeObjectURL(link.href)
});
}