// 下载导出内容,带类型的
export function downloadFile(data, config = {}) { const aLink = document.createElement("a"); let blob = new Blob([data], { // type: 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' type: 'application/zip' }) aLink.href = URL.createObjectURL(blob); aLink.download = (config).name; document.body.appendChild(aLink); aLink.click(); document.body.removeChild(aLink); }
2./下载,打印,下载源文件,不加mime类型
//下载,打印,下载源文件,不加mime类型 export function initialDownloadFile(data,config={}) { const aLink = document.createElement("a"); aLink.href = data; aLink.download = (config).name; document.body.appendChild(aLink); aLink.click(); document.body.removeChild(aLink); }