云储存成功回调更新页面数据失败
doUpload: function () { var that = this; // 选择图片 wx.chooseImage({ count: 1, sizeType: ['original', 'compressed'], sourceType: ['album', 'camera'], success: function (res) { wx.showLoading({ title: '上传中', }) const filePath = res.tempFilePaths[0] var fileName = filePath[11] + filePath[12] + filePath[59] + filePath[60] + filePath[101] + filePath[102] const cloudPath = fileName + filePath.match(/\.[^.]+?$/)[0] // 上传图片 wx.cloud.uploadFile({ cloudPath, filePath, success: res => { that.setDate({ vsimgurl: res.fileID }) console.log('[上传文件] 成功:', res) }, fail: e => { console.error('[上传文件] 失败:', e) wx.showToast({ icon: 'none', title: '上传失败', }) }, complete: () => { wx.hideLoading() } }) }, fail: e => { console.error(e) } }) }, |
上面是我的代码
主要是上传文件成功后回调,需要更新页面图片路径的数据,一直失败,不懂为啥
求大神解答
