3***@qq.com
3***@qq.com
  • 发布:2024-10-29 17:58
  • 更新:2024-11-01 14:52
  • 阅读:41

关于uni-admin中filterChange用法

分类:uniCloud

preWhere && newWhere 如何拼接?
filterChange(e, name) {
this._filter[name] = {
type: e.filterType,
value: e.filter
}
let newWhere = filterToWhere(this._filter, db.command)
if (Object.keys(newWhere).length) {
// 例如 preWhere = "status === 1"
// this.where = preWhere && newWhere 如何拼接
} else {
this.where = ''
}
this.$nextTick(() => {
this.$refs.udb.loadData()
})
}

2024-10-29 17:58 负责人:无 分享
已邀请:
DCloud_uniCloud_VK

DCloud_uniCloud_VK

可参考如下代码
通过 db.command.and([newWhere, preWhere]) 来拼接

    let newWhere = filterToWhere(this._filter, db.command)  
                let preWhere = {  
                    username: "admin"  
                }  
                if (Object.keys(newWhere).length) {  
                    this.where = db.command.and([newWhere, preWhere])  
                } else {  
                    this.where = ''  
                }

要回复问题请先登录注册