Advertisement

微信小程序云开发使用and/or逻辑操作符

阅读量:

记录 2020-07-28

逻辑操作符and

and 方法 区间范围
在and的实现过程中,依然采用command方法,并调用gt、lt、eq等操作。

实例
x:.and(.gt(0),_.lt(100)) 通过调用command方法中的and功能,在括号内部依次使用gt与lt方法,从而筛选出大于0且小于100的数值

复制代码
    getData(){
    db.collection("demolist")
    .where({
      x:_.and(_.gt(0),_.lt(100))
    })
    .get()
    .then(res=>{
      console.log(res); 
      this.setData({
        dataList:res.data
      })
    })
      },
    
    
      
      
      
      
      
      
      
      
      
      
      
      
      
    

逻辑操作符 or

or的用法

获得44或66

复制代码
    .where({
     x:_.or(_.e

全部评论 (0)

还没有任何评论哟~