微信小程序报错: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);}//保存授权信息失败

    })

  }

 

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