小程序
小游戏
企业微信
微信支付
扫描小程序码分享
- 当前 Bug 的表现(可附上截图)
使用downloadFile API 下载后的临时路径可以打开,而且saveFile API保存的文件无法在手机上找到,使用腾讯文档APP也无法找到
1 个回答
加粗
标红
插入代码
插入链接
插入图片
上传视频
wx.downloadFile({ // 示例 url,并非真实存在 url: 'http://example.com/somefile.pdf', success(res) { const filePath = res.tempFilePath wx.openDocument({ filePath:savedFilePath, success(res) { console.log('打开文档成功') } }) } })
wx.downloadFile({ // 示例 url,并非真实存在 url: 'http://example.com/somefile.pdf', success(res) { const filePath = res.tempFilePath wx.openDocument({
filePath:savedFilePath,
success(res) { console.log('打开文档成功') } }) } })
你好,麻烦通过点击下方“反馈信息”按钮,提供出现问题的。
非常感谢,这种方法确实可行,但是我的需求是要保存在本地,然后再打开文档,如果无法打开本地文档,那么只能退而求其次选择这种方式了
看下这篇文档
https://developers.weixin.qq.com/miniprogram/dev/framework/ability/file-system.html
关注后,可在微信内接收相应的重要提醒。
请使用微信扫描二维码关注 “微信开放社区” 公众号
wx.downloadFile({ // 示例 url,并非真实存在 url: 'http://example.com/somefile.pdf', success(res) { const filePath = res.tempFilePath wx.openDocument({
filePath:savedFilePath,
success(res) { console.log('打开文档成功') } }) } })
非常感谢,这种方法确实可行,但是我的需求是要保存在本地,然后再打开文档,如果无法打开本地文档,那么只能退而求其次选择这种方式了
看下这篇文档
https://developers.weixin.qq.com/miniprogram/dev/framework/ability/file-system.html