收藏
回答

使用wx.downloadFile无法正确下载pdf?

const {
      preview
    } = e.currentTarget.dataset
    console.log('链接地址', preview)
    wx.downloadFile({
      // 示例 url,并非真实存在
      url: preview,
      successfunction (res{
        console.log('res', res)
        const filePath = res.tempFilePath
        wx.openDocument({
          filePath: filePath,
          successfunction (res{
            console.log('打开文档成功')
          },
          failfunction (err{
            console.log(err)
          }
        })
      }
    })


其中preview是.pdf结尾的文件地址

但是下载之后之后变成了.bin文件,这是为什么呢

回答关注问题邀请回答
收藏

3 个回答

登录 后发表内容