1
This commit is contained in:
@@ -57,18 +57,18 @@ export {
|
||||
*/
|
||||
export async function DownloadImages(list:Array<{url:string,name:string}>, onProgress?:(count:number,total:number,item:any)=>void, onError?:(count:number,total:number,item:any)=>void, onSuccess?:(successCount:number,errCount:number)=>void) {
|
||||
const total = list.length;
|
||||
var count = 0;
|
||||
var successCount = 0;
|
||||
var errCount = 0;
|
||||
let count = 0;
|
||||
let successCount = 0;
|
||||
let errCount = 0;
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
await new Promise((resolve) => {
|
||||
let xhr = new XMLHttpRequest();
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", list[i].url);
|
||||
xhr.responseType = "blob"
|
||||
xhr.onload = function () {
|
||||
count++;
|
||||
if (this.status === 200) {
|
||||
let blob = this.response;
|
||||
const blob = this.response;
|
||||
const a = document.createElement('a');
|
||||
a.href = URL.createObjectURL(blob);
|
||||
a.download = list[i].name || list[i].url;
|
||||
|
||||
Reference in New Issue
Block a user