1、JS批量下载文件,用a标签 download,只能下载最后一个
2、 代码:
var a = document.createElement(“a”),//创建一个标签
e = document.createEvent(“mouseevents”); //创建鼠标事件对象
e.initMouseEvent(“click”,false,false); //初始化事件对象
a.href = href; //设置下载地址
a.download = name; //设置下载文件名
a.dispatchevent(E); //给指定的元素,执行事件单击事件
FileSaver了解下 :
https://github.com/eligrey/FileSaver.js
;