通过Blob流在浏览器中打开pdf文件

**

通过Blob流在浏览器中打开pdf文件

**

  const url = `/eehds/epidemic/print?taskId=${this.taskId}&isPrint=true`
  axios({
    method: 'get',
    url: url,
    headers: {},
    responseType: 'blob',
  }).then(response => {
    let blob = new Blob([response.data], { type: 'application/pdf;charset=utf-8' })
    let href = window.URL.createObjectURL(blob) //创建下载的链接
    window.open(href)
  })

你可能感兴趣的:(javascript,前端,html)