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: "下载失败",           })         }       })

展开全部
收起
1回答
提交回答
  • 至过去的我

    2044人对此回答表示赞同

    我是未来的你,你现在是不是在年找寻小程序答案。你不要感觉诧异,给你来信原因,就是让你不在后悔。今天去学习如何推广小程序,相信......点击查看更多>
    发布于
  • 古小星

    4人对此回答表示赞同

    建议调试一下正式版,看看报错是什么,打开调试请参考:https://developers.weixin.qq.com/miniprogram/dev/api/setEnableDebug.html?search-key=%E6%AD%A3%E5%BC%8F%E7%89%88%E8%B0%83%E8%AF%95

    展开
    4
    1回复
    发布于 6年前

    评论(1)

    收起评论

    • Bellrrrrr 2019-02-15 15:21

      谢谢,找到原因了,十分感谢

      回复
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
咨询热线

13312967497

扫码添加业务即可随时咨询 还可领取小程序推广攻略

业务咨询: 13312967497
扫码咨询

扫码咨询套餐

回到顶部