微信小程序wx.downloadFile下载文件,接口被拦截了怎么处理?
发布于 6 年前 作者 min90 4809 次浏览 来自 官方Issues
wx.downloadFile({
      url:'https://xxxxx' ,
      success:function(resData) {
        const tempFilePath = resData.tempFilePath
        wx.saveFile({
          tempFilePath: tempFilePath,
          success(res) {
            const savedFilePath = res.savedFilePath
            wx.openDocument({
              filePath: savedFilePath,
              success: function (res) {
                debugger
                console.log('打开文档成功')
              },
            });
          }
        })
      },
      fail:function(err) {
        wx.showToast({
          title: '下载失败',
        })
      }
    })
1 回复

请具体描述问题,并提供appid和能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

回到顶部