微信小程序wx.downloadFile下载文件,temp返回的是json而不是.xlsx?
发布于 7 年前 作者 jfan 9019 次浏览 来自 官方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: '下载失败',
        })
      }

    })


回到顶部