当前位置:网站首页>Cloud function realizes fuzzy search function

Cloud function realizes fuzzy search function

2022-06-22 04:21:00 JSONP$

Cloud function realizes fuzzy search function

  sou(e){
    
       
        console.log(e.detail);
        const searchKey =e.detail
        if(searchKey&&searchKey.length>0){
    

            //  Fuzzy search code 
            
            db.collection('zhusir_video').where({
    
                name:db.RegExp({
    
                    regexp:searchKey,
                    options:'i'
                })

            }).get()
            .then(res=>{
    
                console.log(res);
                console.log(res.data);
                this.setData({
    
                    searchValue:res.data
                  })
              
            }).catch(res=>{
    
                console.log(res);

            })
          }else{
    
            wx.showToast({
    
              title: ' The search term cannot be empty ',
              icon:'none'
            })
        }
        
    },
原网站

版权声明
本文为[JSONP$]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/172/202206211426162476.html