利用JSzip进行多类型文件下载(pdf、图片类型)
封装下载zip逻辑代码,可多处重复使用 import JSzip from 'JSzip' import { base64ToBlob } from './base64ToBlob' import type { DownloadList } from '@/views/audit/element/types' /** * 下载zip文件 * @param fileName 文件名(不需要加后缀){string} * @param downloadList 压缩包内文件的列表 {DownloadList[]} */ export function downloadZip(fileName: string, downloadList: DownloadList[]) { const zip = new JSzip() const fileNames: string[] = [] downloadList.forEach((item) => { const filename = item.fileName const blob = base64ToBlob(item.url, ite....