unicloud-db 获取不到数据,xid 是有值的

小朋友
- 发布:2022-03-17 17:21
- 更新:2022-03-25 10:34
- 阅读:840
unicloud-db 获取不到数据,xid 是有值的
分类:uniCloud



组件默认会加载数据,在加载的过程中再次修改where,因上次结果没有返回,此次的where会被忽略掉,参考文档代码,设置组件加载数据模式为手动 loadtime="manual"
<template>
<view>
<unicloud-db ref="udb" collection="uni-id-users" :where="sWhere" loadtime="manual"></unicloud-db>
</view>
</template>
<script>
export default {
data() {
return {
tempstr: '123',
sWhere: ''
}
}
onLoad() {
this.sWhere = "id=='" + this.tempstr + "'"
// 组件上配置了 loadtime = "manual", 这里需要手动加载数据
this.$nextTick(() => {
this.$refs.udb.loadData()
})
// 多条件示例
// id = this.tempstr 且 create_time > 1613960340000
// this.sWhere = "id=='" + this.tempstr + "' && create_time > 1613960340000"
// id = this.tempstr 或 name != null
// this.sWhere = "id=='" + this.tempstr + "' || name != null"
}
}
</script>