收藏
回答

downloadFile通过流下来的xls提示文件格式和扩展名不匹配,求大神指导下?

       const filePath = `${ wx.env.USER_DATA_PATH}/${projectName}.xls`;

        wx.downloadFile({
      url"http://192.168.100.33:8096/devled" + "/api/project/exportAioResult?myNo=" + id,
      header: {
        "Authorization": userInfo ? JSON.parse(userInfo).token : "eyJhbGciOiJIUzUxVs_C0x1_r_u1nTY6gQPJYPclBh-Mg"
       },
      filePath: filePath,
      responseType"arraybuffer"//注意这里的responseType
      successfunction (res{
        console.log(res)
        wx.openDocument({
          filePath: res.filePath,
          fileType'xls',
          successfunction () {
            console.log('打开文档成功')
          },
          failfunction () {
            console.log('打开失败');
          }
        })
      }
    })


结果

点是可以在PC上打开,手机打不开

最后一次编辑于  2022-05-20
回答关注问题邀请回答
收藏

2 个回答

  • YU
    YU
    2024-04-30


    有好的解决方法吗

    2024-04-30
    有用
    回复
  • Practice in daily life
    Practice in daily life
    2022-05-20

    这个注释一下试试

    2022-05-20
    有用
    回复
登录 后发表内容