downloadWithCompress (imglist, zipName) {
const JSZip = require('jszip');
const { saveAs } = require('file-saver');
const zip = new JSZip();
const promises = [];
imglist.forEach((item) => {
const fileData = this.$axios.get(item.url, {
responseType: 'blob',
withCredentials: false
}).then((res) => {
zip.file(item.name, res.data);
return res;
}).catch(() => {
return false;
});
promises.push(fileData);
});
Promise.all(promises).then(() => {
zip.generateAsync({ type: 'blob' }).then((content) => {
saveAs(content, '' + zipName + '.zip');
});
});
},