downloadFile下载文件没有后缀名 如何解决
发布于 3 年前 作者 qinjing 1270 次浏览 来自 分享

wx.downloadFile({

      url: e.currentTarget.dataset.url,

      success: function (res) {

        const fileManager = wx.getFileSystemManager()

        const filePath = wx.env.USER_DATA_PATH + '/xxxx.xlsx'

        fileManager.saveFile({

          tempFilePath: res.tempFilePath,

          filePath,

          success: () => {

            wx.openDocument({

              filePath: filePath,

              showMenu: true,

              fileType: 'xlsx'

            })

            wx.hideLoading()

          }

        })

      }

    })

回到顶部