mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-13 04:46:44 +08:00
导出pdf打不开解决
This commit is contained in:
@@ -152,8 +152,9 @@ const exportPdf=function (udata){
|
|||||||
headers: { 'XBOE-Access-Token':getToken(),'Content-Type':'application/pdf;charset=utf-8'}
|
headers: { 'XBOE-Access-Token':getToken(),'Content-Type':'application/pdf;charset=utf-8'}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
//resolveBlob(res, mimeMap.zip);
|
//resolveBlob(res, mimeMap.zip);
|
||||||
|
console.log(res);
|
||||||
const aLink = document.createElement('a')
|
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") 设置的文件名;
|
// //从response的headers中获取filename, 后端response.setHeader("Content-disposition", "attachment; filename=xxxx.docx") 设置的文件名;
|
||||||
//var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
|
//var patt = new RegExp('filename=([^;]+\\.[^\\.;]+);*')
|
||||||
//var contentDisposition = decodeURI(res.headers['content-disposition'])
|
//var contentDisposition = decodeURI(res.headers['content-disposition'])
|
||||||
@@ -165,6 +166,7 @@ const exportPdf=function (udata){
|
|||||||
document.body.appendChild(aLink)
|
document.body.appendChild(aLink)
|
||||||
aLink.click()
|
aLink.click()
|
||||||
document.body.removeChild(aLink)
|
document.body.removeChild(aLink)
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user