1 async downloadFun() { // 下载使用说明书 2 const InstructionManualvv = await InstructionManual(); 3 4 let blob = new Blob([InstructionManualvv.data], {type: ‘application/pdf;charset=UTF-8‘}); 5 let fileName = ‘使用说明书.pdf‘; 6 if (window.navigator.msSaveOrOpenBlob) { 7 navigator.msSaveBlob(blob, fileName) 8 } else { 9 var link = document.createElement(‘a‘); 10 link.href = window.URL.createObjectURL(blob); 11 link.download = fileName; 12 link.click(); 13 window.URL.revokeObjectURL(link.href) //释放内存 14 } 15 },
原文地址:https://www.cnblogs.com/xiaozhu-zhu/p/11984864.html
时间: 2024-11-14 11:45:08