
在小程序项目中,使用uni.chooseFile报错【TypeError: e.chooseFile is not a function】(如上图),将新版uni.chooseFile改成uni.chooseMessageFile
uni.chooseMessageFile({
count: 1,
// type: 'file',
extension: ['.doc','.pdf','.docx'],
success(res) {
let _this = this
uni.downloadFile({
url: _this.imgUrl(path),
success: function(res) {
let filePath = res.tempFilePath
uni.openDocument({
filePath: filePath,
showMenu: true,
success: function(res) {
}
})
}
})
}
});
在小程序项目中遇到uni.chooseFile报错,错误信息为TypeError:e.chooseFileisnotafunction。为解决问题,已将代码中的uni.chooseFile替换为uni.chooseMessageFile,并限制了文件类型为.doc,.pdf,.docx。在微信开发者工具中功能运行正常,但手机上显示无内容时,需检查兼容性和配置问题。
8016





