Live2d Test Env

前端实现下载pdf文件

 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             },

 

posted @ 2019-12-04 19:14  小猪(朱)  阅读(6930)  评论(0编辑  收藏  举报