微信小程序報錯:Uncaught (in promise) ReferenceError: _ is not defined( INC自增自減 MUL 自乘 相關問題)

微信小程序報錯:Uncaught (in promise) ReferenceError: _ is not defined

解決辦法:在你的代碼中添加如下代碼中 紅色部分

//保存授權信息shouquan_type: ture 增加1 false 減少1

  save_shouquan_info(openid,shouquan_type,callback){

    const _ = wx.cloud.database().command;

    let dt = shouquan_type ? {shouquan_num:_.inc(1)} : {shouquan_num:_.inc(-1)};

    let dingyue = wx.cloud.database().collection('dingyue');

    dingyue.where( {_openid:openid} ).update({

      data:dt,

      success(res){callback(true);},//保存授權信息成功

      fail(res){callback(false);}//保存授權信息失敗

    })

  }

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章