<uni-clientdb ref="udb" @load="handleLoad"
v-slot:default="{data, loading, pagination, error, options}" collection="resident"
:where='sWhere1'>
</uni-clientdb>
onLoad(e) {
const account = e.account
this.account = account
this.sWhere1 = "residenttype == 'residenttype1' && account =='" + this.account + "'"
}
本人小白,为了毕设用了uniapp,结果遇上这个问题,已经折腾一整天了还没有解决,希望有大佬能指点迷津一下,谢谢!
l***@163.com (作者)
您好,我查看了下用console.log()把我这个sWhere1字符串在h5端和小程序端输出的结果是一样的,都是
residenttype == 'residenttype1' && account =='123'
另外,微信开发者工具调试器里的network返回的结果是把我这个数据表内的所有记录都返回来了
2021-05-22 13:17
l***@163.com (作者)
因为我连接到了云端云函数,我查看了一下云数据库里的clientDB扩展日志,发现日志的这条记录里就没有where的内容
2021-05-22 13:20
DCloud_uniCloud_WYQ
回复 l***@163.com: 你用的这个组件过时了,现在已经内置 https://uniapp.dcloud.net.cn/uniCloud/unicloud-db 。另外你这个问题应该是时机问题,onLoad触发之前就已经发送请求加载数据了
2021-05-22 14:19
l***@163.com (作者)
回复 DCloud_uniCloud_WYQ: 您好,谢谢您!您的回答提醒到我了,我之后仔细看了看文档,应该利用好manual和loadData()来处理好加载数据的先后问题的,现在解决这个问题了。谢谢您对于我这种小白问题还很有耐心的解答!
2021-05-24 23:39
h***@163.com
回复 l***@163.com: 我这边遇到了跟你一模一样的问题,答案中的loadData是什么意思?有没有相关指引可供参考。
2021-06-22 22:22
h***@163.com
回复 l***@163.com: 参考复现的语句如下,IdCond的默认值为‘id==1',然后我在onLoad里面把他设置成'id==2'.在展示的时候第一行的view会展示'id==2'出来;在h5的情况下,查询数据库的日志记录也是'id==2';但是在微信小程序的情况下,查询数据库的日志就是'id==1'了。
<template>
<view class="uni-padding-wrap">
<view>{{IdCond}}</view>
<unicloud-db v-slot:default="{data, loading, error, options}" collection="item" :where="IdCond" :getone="true">
</unicloud-db>
</view>
</template>
2021-06-22 22:28
不将就1207
回复 l***@163.com: 你好,我也遇到这个问题,请问你是怎么解决的呢?方便贴下代码吗
2021-11-16 11:01