Vue-fuyu 2019-10-30 10:03 采纳率: 0%
浏览 1048
已结题

使用pdf.js,点击预览显示的不是需要的文件,而是网址首页,这是什么问题?

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
})

  • 写回答

2条回答 默认 最新

  • threenewbee 2019-10-30 10:11
    关注

    浏览器 f12 抓包看下,你请求的是不是 pdf 的地址,服务器是否返回了什么错误信息,比如没有权限、文件找不到之类。

    评论

报告相同问题?