打包下载怎么实现?

down_zbUploadClearfile({ //http接口

name:'1'

time:'7',

}).then(async (res) => {

if (res) {

this.selectData = [];

const zip = new JSZip();

zip.generateAsync({ type: "object" }).then(() => {

const downloadUrl = window.URL.createObjectURL(res);

const link = document.createElement("a");

link.href = downloadUrl;

link.setAttribute("download", `123test.zip`);

appendChild(link);

link.click();

// 释放 URL 对象

URL.revokeObjectURL(link.hrefs);

});

}

});

相关推荐
前端小超超几秒前
如何配置capacitor 打包的安卓app固定竖屏展示?
android·前端·gitee
B612 little star king12 分钟前
力扣29. 两数相除题解
java·算法·leetcode
野犬寒鸦13 分钟前
力扣hot100:环形链表(快慢指针法)(141)
java·数据结构·算法·leetcode·面试·职场和发展
xiaopengbc14 分钟前
在Webpack中,如何在不同环境中使用不同的API地址?
前端·webpack·node.js
上官浩仁18 分钟前
springboot synchronized 本地锁入门与实战
java·spring boot·spring
前端AK君19 分钟前
React中台系统如何嵌入到业务系统中
前端
Gogo81620 分钟前
java与node.js对比
java·node.js
Slice_cy21 分钟前
不定高虚拟列表
前端
SmartJavaAI26 分钟前
Java调用Whisper和Vosk语音识别(ASR)模型,实现高效实时语音识别(附源码)
java·人工智能·whisper·语音识别
用户37215742613529 分钟前
Python 高效实现 Word 转 PDF:告别 Office 依赖
java