Click to download the file on the front-end page

//url: 下载链接
download(url) {
    
    
    console.log(url, 333);
    let eleLink = document.createElement("a");
    eleLink.download = url;
    eleLink.style.display = "none";
    eleLink.href = url;
    document.body.appendChild(eleLink);
    eleLink.click();
    document.body.removeChild(eleLink);
  }

Guess you like

Origin blog.csdn.net/be_strong_web/article/details/127727832