同样碰到这个问题。。微信开发团队不关注下??
无法在小程序里查看PDF(Google Play版微信7.0.3)- 当前 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);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码]
2019-04-08