云开发-数据库,关键词搜索

52 阅读1分钟
    db.collection('输入你查询的表名').where({
            name: db.RegExp({
                regexp: this.data.search,
                options: 'i',
            }),
        }).get().then(res => {
            if (res.data.length != 0) {
                this.setData({
                    shangpinbiao: res.data
                })
            } else {
                wx.showToast({
                    title: '未找到',
                    icon: 'none'
                })
            }
        })

在腾讯云开发中-数据库,关键词搜索用:

.where({
	name: db.RegExp({
		regexp: '关键词',
		options: 'i',
	})
})

//name 为搜索的字段