wx.chooseMessageFile 调用出现暂不支持当前功能?
wx.chooseMessageFile,手机型号:mate20,微信版本8.0.3
wxml
<view class="doc-select-item" catch:tap="uploadDoc">从微信聊天中选择文档</view>
js
uploadDoc() {
wx.chooseMessageFile({
count: 1,
type: "file",
extension: ["doc", "ppt", "xls", "xlsx", "docx", "pdf", "pptx"],
success: (res) => {
wx.showLoading({ mask: true, title: "正在上传..." });
let filePath = res.tempFiles[0].path;
let userFileName = res.tempFiles[0].name;
let fileName =
"/miniapp/doc/" +
uuidTime() +
"/" +
uuid() +
filePath.substring(filePath.indexOf("."));
upload(fileName, filePath, (data) => {
if (data.statusCode == 200) {
that.setData({
type: 4,
uploadType: 4,
docUrl: "https://" + data.Location,
docName: userFileName,
ossKeyName: data.ETag.substring(1, data.ETag.lastIndexOf('"')),
savePath: "https://" + data.Location,
});
that.closeDocSelect();
}
wx.hideLoading();
});
},
});
},