使用wx.openDocument时报错,提示openDocument:fail?
wx.downloadFile({
url: att.url,
success: (res) => {
wx.openDocument({
filePath: res.tempFilePath,
fileType: att.extension,
success: (result) => {
wx.hideLoading();
},
fail: (error) => {
wx.hideLoading();
let str;
if (typeof error === "string") {
str = error;
} else {
str = JSON.stringify(error);
}
wx.showToast({
title: "打开错误:" + str,
duration: 3000,
});
},
});
},
fail: (error) => {
wx.hideLoading();
let str;
if (typeof error === "string") {
str = error;
} else {
str = JSON.stringify(error);
}
wx.showToast({
title: "下载错误:" + str,
duration: 3000,
});
},
});
[图片] 已经成功下载,downloadFile的success回调内,openDocument的时候报错了,理论上如果下载不下来,或者手机内存满了,应该不会走success回调,