小程序刚出来,因为预研需要,很不幸的做了一回小白鼠,于是掉进了神坑。
下载文件,首先是没报错了,然后不成功,这个时候,请把 fail打开,把fail的报错信息输出来
wx.downloadFile({
url: 'https://xxxx.xxx.com/test.doc',
success: function (res) {
console.log('111')
var filePath = res.tempFilePath
wx.openDocument({
filePath: filePath,
success: function (res) {
console.log('打开文档成功')
}
})
},
fail:function(err){
console.log(err)
}
})
输出来后,发现出现了这个: