3 回复
kwu
kwu1 楼5 年前

wx.downloadFile(

              {

              url:url,

              // filePath:wx.env.USER_DATA_PATH+'/'+this.data.fileName,

              success: function (res) {

                console.log(res)

                const filePath = res.tempFilePath;

                // const filePath=res.filePath;

                console.log(filePath);

                wx.openDocument({

                  filePath: filePath,

                  fileType: 'xlsx',

                  showMenu: true,

                  success: function (res) {

                    console.log('打开文档成功')

                    wx.hideLoading()

                  },

                  fail: function (res) {

                    console.log(res);

                  },

                  complete: function (res) {

                    console.log(res);

                  }

                })

              },

这样写 打开的数据就正常 但是文件夹名称是乱码的 把注释切回来 filepath换了 出来的就是改之后的文件夹名 但是会打开旧文件 而不是新下载的文件

nhao
nhao2 楼5 年前

把名字改成选择文件的名字呐

lidu
lidu3 楼5 年前

垃圾啊啦啦啦痢疾杆菌矮灵祭管理机构