示例代码有错:https://developers.weixin.qq.com/miniprogram/dev/wxcloud/reference-sdk-api/storage/uploadFile/client.uploadFile.html https://developers.weixin.qq.com/miniprogram/dev/api/media/video/wx.chooseMedia.html wx.chooseMedia({ count: 9, mediaType: ['image','video'], sourceType: ['album', 'camera'], maxDuration: 30, camera: 'back', success(res) { console.log(res.tempFiles.tempFilePath)// 改为console.log(res.tempFiles[0].tempFilePath)否则打印不出来 console.log(res.tempFiles.size) // console.log(res.tempFiles[0].size)同理 } }) wx.cloud.uploadFile({ cloudPath: 'example.png', filePath: '', // 文件路径,不能加单引号,否则报错 success: res => { // get resource ID console.log(res.fileID) }, fail: err => { // handle error } }) 最后,我骂骂咧咧的离开。
wx.chooseMedia 示例代码有误示例代码是 wx.chooseMedia({ count: 9, mediaType: ['image','video'], sourceType: ['album', 'camera'], maxDuration: 30, camera: 'back', success(res) { console.log(res.tempFiles.tempFilePath) console.log(res.tempFiles.size) } }) res.tempFiles 是一个数组
2023-11-14