苹果端 wx.openDocument 无法打开文件?电脑模拟器和安卓手机可以?
发布于 6 年前 作者 wangguiying 15126 次浏览 来自 问答

wx.openDocument 和wx.downloadFile

 wx.downloadFile({
          url: app.globalData.ah_url +  "url",
         
          method:'GET',
          successfunction(res{
              console.log(res);
              const tempFilePath = res.tempFilePath;
              console.log(tempFilePath);
                    wx.openDocument({
                      filePath: tempFilePath,
                      fileType'xlsx',
                      successfunction (res{
                        console.log('打开文档成功')
                      },
                      failfunction(res{
                        console.log("打开文档失败")
                      }
                    });
          },
          failfunction(res{
            console.log(res);
              console.log('文件下载失败');
          },
          completefunction(res{},
      })     complete: function(res{},
      })
1 回复

打开调试试下

回到顶部