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
success: function (res) {
console.log(res)
wx.openDocument({
filePath: res.filePath,
fileType: 'xls',
success: function () {
console.log('打开文档成功')
},
fail: function () {
console.log('打开失败');
}
})
}
})
结果
点是可以在PC上打开,手机打不开
有好的解决方法吗
这个注释一下试试