課程
/前端開發
/小程序
/輕松入門微信小程序與云開發
使用update函數之后,云開發數據庫集合數據無法更新
2020-06-23
源自:輕松入門微信小程序與云開發 3-2
正在回答
你直接復制這段代碼試試
wx.cloud.uploadFile({
??????????//?指定上傳到的云路徑
??????????cloudPath:?new?Date().getTime()+'png',
??????????//?指定要上傳的文件的小程序臨時文件路徑
??????????filePath:?tempFilePaths[0],
??????????//?成功回調
??????????success:?res?=>?{
????????????console.log(res.fileID)
????????????db.collection('Image').add({
??????????????data:{
??????????????fileID:res.fileID
??????????????}
????????????}).catch(err=>{
??????????????console.error(err)
????????????}).then(res=>{
??????????????console.log(res)
????????????})
????????????console.log('上傳成功',?res)
??????????},
??????????fail:console.error
????????})
舉報
深入淺出微信小程序核心基礎與云開發,使你掌握小程序開發必備技能。
1 回答使用update函數之后,云開發數據庫集合數據無法更新?
1 回答怎樣使用云數據庫
2 回答從云數據庫user集合隨機取出的數據未定義
1 回答保存到云數據庫之后無法跳轉到首頁
1 回答老師,請問怎么用云函數刪除別人發布在數據庫里的數據?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2020-06-23
你直接復制這段代碼試試
wx.cloud.uploadFile({
??????????//?指定上傳到的云路徑
??????????cloudPath:?new?Date().getTime()+'png',
??????????//?指定要上傳的文件的小程序臨時文件路徑
??????????filePath:?tempFilePaths[0],
??????????//?成功回調
??????????success:?res?=>?{
????????????console.log(res.fileID)
????????????db.collection('Image').add({
??????????????data:{
??????????????fileID:res.fileID
??????????????}
????????????}).catch(err=>{
??????????????console.error(err)
????????????}).then(res=>{
??????????????console.log(res)
????????????})
????????????console.log('上傳成功',?res)
??????????},
??????????fail:console.error
????????})