导出pdf打不开解决

This commit is contained in:
86182
2022-10-18 17:29:56 +08:00
parent 37588ad042
commit bce2ac3805

View File

@@ -152,8 +152,9 @@ const exportPdf=function (udata){
headers: { 'XBOE-Access-Token':getToken(),'Content-Type':'application/pdf;charset=utf-8'}
}).then(res => {
//resolveBlob(res, mimeMap.zip);
console.log(res);
const aLink = document.createElement('a')
var blob = new Blob([res], { type: 'application/pdf' })
var blob = new Blob([res.request.response], { type: 'application/pdf' })
// //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
//var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
//var contentDisposition = decodeURI(res.headers['content-disposition'])
@@ -165,6 +166,7 @@ const exportPdf=function (udata){
document.body.appendChild(aLink)
aLink.click()
document.body.removeChild(aLink)
})
}