微信小程序打开预览下载的文件
微信小程序开发交流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;(文件类型)
可以在小程序预览了
TAG标签: 微信小程序微信文件打开方式设置
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。

