收藏
回答

PC端小程序使用wx.openDocument打开pdf失败?

代码片段如下:

wx.downloadFile({
  url: api.FileRootPath + that.data.info.swReceivingRecords.attachment,
  success: function (res) {
    const filePath = res.tempFilePath
    wx.openDocument({
      filePath: filePath,
      success: function (res) {
        console.log('打开文档成功')
      },
     failfunction (res{
     console.log("fail");
      console.log(res)
   },
  completefunction (res{
     wx.hideLoading();
     console.log("complete");
     console.log(res)
  }
})
}
})

同一部分代码在android和IOS端都可以运行小程序打开pdf,在PC上不能打开。打开失败


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

2 个回答

登录 后发表内容