openDocument api 在真机中打开文档一直无法打开,但是提醒打开文档成功,这是为啥呢?路径都拿到了
openFile(filePath) {
wx.showLoading({
title: “正在打开中”,
icon: “loading”,
duration: 2000
});
wx.downloadFile({
url: filePath,
success: (res) => {
console.log(“11111”, res);
const filePath = res.tempFilePath;
var index = filePath.lastIndexOf(".");
let fileType = filePath.substring(index + 1, filePath.length);
let openFileType;
switch (fileType) {
case “docx”:
openFileType = “docx”;
break;
case “word”:
openFileType = “docx”;
break;
case “excel”:
openFileType = “xlsx”;
break;
case “xlsx”:
openFileType = “xlsx”;
break;
case “xls”:
openFileType = “xls”;
break;
case “ppt”:
openFileType = “ppt”;
break;
case “pptx”:
openFileType = “pptx”;
break;
case “pdf”:
openFileType = “pdf”;
break;
default:
openFileType = “doc”;
break;
}
wx.openDocument({
filePath: filePath,
fileType: openFileType,
success: (res) => {
console.log(“打开文档成功”);
},
fail: (res) => {
console.log(res);
}
});
},
fail: (res) => {
console.log(res);
wx.showToast({
title: “文件下载失败”
});
},
complete: () => {
wx.hideLoading();
}
});
},
ios打开文档报错 安卓没有问题 文档地址https://e6kang.oss-cn-hangzhou.aliyuncs.com/develop/2019-12-06/5de9ff69d70a0.xlsx
麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)