systhinker
systhinker
  • 发布:2024-04-21 16:25
  • 更新:2024-04-21 20:11
  • 阅读:274

【报Bug】unicloud-db 加载分页时,数据重复,且丢失后续页面数据

分类:uniCloud

产品分类: uniCloud/腾讯云

示例代码:

<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @error="onqueryerror" :collection="colList" :page-size="10" getcount="true" @load="afterDBload" loadtime="onready" :groupby="groupby" :group-field="groupField" orderby="indexList desc" >
<uni-pagination show-icon :page-size="pagination.size" :total="pagination.count" @change="onpagination" />
<!-- 列表 -->
<uv-index-list :indexList="indexList" customNavHeight="100rpx">
<text>省略</text>
</uv-index-list>

        <text>hasMore:{{hasMore}}</text>  
        <uni-load-state @networkResume="refresh" :state="{data,pagination,hasMore, loading, error}"  
            @loadMore="loadMore">  
        </uni-load-state>  

</unicloud-db>
<script>
data() {
return {
where: '"article_status" == 1',
groupby:'dateToString(add(new Date(0),start_time),"%Y-%m-%d","+0800") as indexList',
groupField:"push({_id: _id, article_status:article_status,open_status:open_status,content:content,content1:content1,content2:content2,action_id:action_id,start_time:start_time,end_time:end_time,duration:duration,view_count:view_count,like_count:like_count,fav_count:fav_count,comment_count:comment_count,is_essence:is_essence}) as itemArr",
indexList:[],
itemArr:[],
}
methods:{
loadMore() {
console.log("loadMore called");
cdbRef.loadMore()
},
}

// #ifndef APP-NVUE
onPullDownRefresh() {
this.refresh()
},
onReachBottom() {
console.log("onReachBottom called");
this.loadMore()
}
// #endif
</script>

操作步骤:

使用分页方式读取数据,每次10条,显示第一页时,用<uni-pagination>组件看有五页(不分页有48条数据),结果列表拉到底时,触发调用unicloud-db的loadmore()方法,读取的数据跟前10条一模一样,而且还把 hasmore标志改为false了,再也触发不了loadmore了。


改where语句,把查询的范围缩小到用户自己,发布到手机上运行,发现有时候可以更新分页数据了,但是每次更新的条数有时候多,有时候少,还是后台有点问题。

预期结果:

希望正常分页

实际结果:

使用分页方式读取数据,每次10条,显示第一页时,用<uni-pagination>组件看有五页(不分页有48条数据),结果列表拉到底时,触发调用unicloud-db的loadmore()方法,读取的数据跟前10条一模一样,而且还把 hasmore标志改为false了,再也触发不了loadmore了。


改where语句,把查询的范围缩小到用户自己,发布到手机上运行,发现有时候可以更新分页数据了,但是每次更新的条数有时候多,有时候少,还是后台有点问题。

bug描述:

使用分页方式读取数据,每次10条,显示第一页时,用<uni-pagination>组件看有五页(不分页有48条数据),结果列表拉到底时,触发调用unicloud-db的loadmore()方法,读取的数据跟前10条一模一样,而且还把 hasmore标志改为false了,再也触发不了loadmore了。


改where语句,把查询的范围缩小到用户自己,发布到手机上运行,发现有时候可以更新分页数据了,但是每次更新的条数有时候多,有时候少,还是后台有点问题。

2024-04-21 16:25 负责人:无 分享
已邀请:
systhinker

systhinker (作者)

是因为这个查询语句太复杂了吗?

要回复问题请先登录注册