axios({
url: this.adress + '/index/download',
headers: this.myHeaders, // 请求头
method: 'get',
params: this.downloadA,
responseType: 'blob'
})
.then(res => {
const binaryData = []
binaryData.push(res)
const url = window.URL.createObjectURL(new Blob(binaryData, { type: 'application/pdf' }))
this.pdfUrl = './static/pdf/web/viewer.html?file=' + encodeURIComponent(url)
this.dialogVisible = true
})
使用pdf.js,点击预览显示的不是需要的文件,而是网址首页,这是什么问题?
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
threenewbee 2019-10-30 10:11关注浏览器 f12 抓包看下,你请求的是不是 pdf 的地址,服务器是否返回了什么错误信息,比如没有权限、文件找不到之类。
解决 无用评论 打赏 举报