后端返回文件流前端下载PDF

      getDownloadApi(value).then(res=>{
        let blob=new Blob([res],{type:'application/pdf;chartset=UTF-8'})
        const url = window.URL.createObjectURL(blob);
        const link = document.createElement('a');
        link.href = url;
        link.setAttribute('download', `${this.topInfo.programmeName}.pdf`);
        document.body.appendChild(link);
        link.click();
      })

 

posted @ 2023-03-29 15:42  健生  阅读(124)  评论(0)    收藏  举报