无法在小程序里查看PDF(Google Play版微信7.0.3)
发布于 5 年前 作者 fqin 7585 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

手机有装PDF阅读器,在微信聊天窗口打开PDF正常,无法在小程序里打开PDF。只有来自Google play的微信有这种情况。

  • 预期表现

可以打开PDF或者弹出选择选择PDF阅读器的弹框。

  • 复现路径
  • 提供一个最简复现 Demo
dowReadPdf (url) {
    const pdfSrc = url || this.data.pdfSrc;
    wx.showLoading({
      mask: true
    });
    wx.downloadFile({
      url: this.data.pdfSrc,
      success(res) {
        wx.hideLoading();
        var filePath = res.tempFilePath;
        console.log('PDF本地路径', filePath)
        wx.openDocument({
          filePath: filePath,
          success: function (res) {
            console.log('打开文档成功')
          },
          fail: function (res) {
            wx.showToast({
              title: '打开PDF失败',
            })
            wx.hideLoading();
            console.log('打开文档失败', res);
          },
        })
      },
      fail: function (res) {
        wx.showToast({
          title: '下载失败: ' + res.errMsg,
          icon: 'none',
        })
        wx.hideLoading();
        console.log('下载文档失败', res);
      },
    })
  }
3 回复

其它渠道安装的就可以打开么?

同样碰到这个问题。。微信开发团队不关注下??

最新版微信 打开word也是 play版本的微信不行!

回到顶部