请问您解决了这个问题了吗
下载pdf文件,wx.saveFile()保存到本地找不到文件?下载pdf,可以打开预览,但是怎么保存到本地呢? 我使用wx.saveFile()保存,但是在手机中找不到相关的文件路径. [图片] [代码]downloadPdf() {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码];[代码][代码] [代码][代码]wx.downloadFile({[代码][代码] [代码][代码]url: [代码][代码]'https://mina.emingfeng.com/stu.pdf'[代码][代码],[代码][代码] [代码][代码]header: {},[代码][代码] [代码][代码]success: [代码][代码]function[代码][代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]"下载---success---"[代码][代码], res)[代码][代码] [代码][代码]var[代码] [代码]path = res.tempFilePath;[代码][代码] [代码][代码]wx.saveFile({[代码][代码] [代码][代码]tempFilePath: path,[代码][代码] [代码][代码]success: [代码][代码]function[代码][代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]'保存文件到本地----success---'[代码][代码], res);[代码][代码] [代码][代码]var[代码] [代码]savedFilePath = res.savedFilePath;[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]pdfPath: savedFilePath[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码][代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]'保存文件到本地----success---'[代码][代码], res);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]complete: [代码][代码]function[代码][代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]'保存文件到本地----success---'[代码][代码], res);[代码][代码] [代码][代码]},[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail: [代码][代码]function[代码][代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]"下载---fail---"[代码][代码], res)[代码][代码] [代码][代码]},[代码][代码] [代码][代码]complete: [代码][代码]function[代码][代码](res) {[代码][代码] [代码][代码]console.log([代码][代码]"下载---complete---"[代码][代码], res)[代码][代码] [代码][代码]},[代码][代码] [代码][代码]})[代码][代码]},[代码] [代码]openPdf(e) {[代码][代码] [代码][代码]var[代码] [代码]x = [代码][代码]this[代码][代码].data.pdfPath;[代码][代码] [代码][代码]wx.openDocument({[代码][代码] [代码][代码]filePath: x,[代码][代码] [代码][代码]fileType: [代码][代码]'pdf'[代码][代码],[代码][代码] [代码][代码]success: [代码][代码]''[代码][代码],[代码][代码] [代码][代码]fail: [代码][代码]''[代码][代码],[代码][代码] [代码][代码]complete: [代码][代码]''[代码][代码],[代码][代码] [代码][代码]})[代码][代码]}[代码]
2020-09-25请问这个问题你有解决吗?
微信小程序下载zip或rar压缩包文件问题[图片] 下载是成功了,1:调用wx.downloadFile在手机文件管理器找不到文件,2:调用wx.downloadFile成功后又调用wx.saveFile在手机文件管理器还是找不到文件,都成功返回了 怎么能实现拿到文件,在小程序下载方式
2020-09-25