downloadFile测试的时候可以正常下载并打开pdf,发布后就下载失败
发布于 6 年前 作者 maofang 9153 次浏览 来自 问答

wx.downloadFile测试的时候可以下载并通过wx.openDocument打开pdf文件,发布正式后,一直提示下载失败,不知道哪里的原因,ip地址代码什么的都没变,就是通过预览扫码测试的时候可以正常下载并打开,正式的却下载失败,代码如下

const downloadTask = wx.downloadFile({         url: that.data.filePath,         success: function (res) {           var filePath = res.tempFilePath;           console.log(filePath+“00000000”)           wx.openDocument({             filePath: filePath,             // fileType:             success: function (res) {               console.log(‘打开文档成功’)               wx.hideLoading();             },             fail: function (res) {               console.log(‘打开文档失败’)               wx.hideLoading();               wx.showToast({                 icon: “none”,                 title: “暂不支持当前文件类型预览”,               })              }           })         },         fail: function (res) {           wx.hideLoading();           console.log(“下载失败”)           wx.showToast({             icon: “none”,             title: “下载失败”,           })         }       })

回到顶部