wx.downloadFile与wx.openDocument结合使用查看文件,手机预览的时候,打开调试的时候就可以成功查看文件,但是关闭调试就报下载失败。我需要如何操作,是否漏掉什么设置?
wx.downloadFile({
url,
success: function (res) {
wx.openDocument({
filePath: res.tempFilePath,
showMenu: true,
fileType,
success: function (res) {
console.log('打开文档成功', res)
},
fail: function (err) {
console.log('打开文档失败', err)
wx.showToast({
icon: "error",
title: "打开文档失败",
});
}
})
},
fail: function (err) {
console.log('下载失败', err)
wx.showToast({
icon: "error",
title: "下载文档失败",
});
}
})

配置下载域名没有
需要你在小程序后台配置downloadFile合法域名。