微信小程序开发交流qq群 173683895
承接微信小程序开发。扫码加微信。
使用 wx.openDocument(obj) 方法预览
wx.downloadFile({ url: 'http://example.com/somefile.pdf', success: function (res) { var filePath = res.tempFilePath wx.openDocument({ filePath: filePath, success: function (res) { console.log('打开文档成功') } }) }})
打开预览文件乱码解决方法:
在后台设置contenttype;(文件类型)
可以在小程序预览了













