const a = document.createElement(‘a‘); // 创建a标签
a.setAttribute(‘download‘, ‘‘);// download属性
a.setAttribute(‘href‘, ‘‘);// href链接
a.click();// 自执行点击事件
原文地址:https://blog.csdn.net/qq_36242361/article/details/83116320
原文:https://www.cnblogs.com/hjbky/p/11495802.html