问题模块 | 框架类型 | 问题类型 | API/组件名称 | 终端类型 | 微信版本 | 基础库版本 |
---|---|---|---|---|---|---|
API和组件 | 小程序 | Bug | wx.openDocument | 客户端 | Google Play版微信7.0.3 | 2.6.5 |
- 当前 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); }, }) } |