From 0137bc7a81af09f69a9f76bd14b5ea8a22a8dc36 Mon Sep 17 00:00:00 2001 From: handongxun Date: Tue, 20 Oct 2020 21:37:38 +0800 Subject: [PATCH] docs: uni-clientdb-component --- docs/uniCloud/uni-clientdb-component.md | 70 ++++++++++++------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/docs/uniCloud/uni-clientdb-component.md b/docs/uniCloud/uni-clientdb-component.md index 1e92d4c4a6..27fd67c814 100644 --- a/docs/uniCloud/uni-clientdb-component.md +++ b/docs/uniCloud/uni-clientdb-component.md @@ -14,7 +14,9 @@ uni-clientdb组件是一个数据库查询组件,它是对uni-clientdb的js库 **平台差异及版本说明** -HBuilderX 2.9.5+ 暂不支持快应用 +|App|H5|微信小程序|支付宝小程序|百度小程序|字节跳动小程序|QQ小程序|快应用|360小程序| +|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:| +|√(2.9.5+)|√|√|√|√|√|√|x|√| #### 属性 @@ -29,7 +31,8 @@ HBuilderX 2.9.5+ 暂不支持快应用 |orderby|string|排序字段及正序倒叙设置| |page-current|Number|当前页| |page-size|Number|每页数据数量| -|need-total|Boolan|是否查询总数据条数,默认 `false`,需要分页模式时指定为 `true`| +|page-data|String|`add` 多次查询的集合, `replace` 当前查询的集合| +|getcount|Boolan|是否查询总数据条数,默认 `false`,需要分页模式时指定为 `true`| |getone|Boolean|指定查询结果是否返回数组第一条数据,默认 false。在false情况下返回的是数组,即便只有一条结果,也需要[0]的方式获取。在true下,直接返回结果数据,少一层数组。应用场景:详情页| |action|string|云端执行数据库查询的前或后,触发某个action函数操作,进行预处理或后处理,[详情](https://uniapp.dcloud.net.cn/uniCloud/uni-clientDB?id=%e4%ba%91%e7%ab%af%e9%83%a8%e5%88%86)。场景:前端无权操作的数据,比如阅读数+1| |manual|Boolean|是否手动加载数据,默认为 false,页面onready时自动联网加载数据。如果设为 true,则需要自行指定时机通过方法`this.$refs.udb.loadData()`来触发联网,其中的`udb`指组件的ref值| @@ -71,8 +74,11 @@ HBuilderX 2.9.5+ 暂不支持快应用 load事件在查询执行后、渲染前触发,一般用于查询数据的二次加工。比如查库结果不能直接渲染时,可以在load事件里先对data进行预处理。 -``` -@load +``` html +... + +... + handleLoad(data, ended, pagination) { // `data` 当前查询结果 // `ended` 是否有更多数据 @@ -82,10 +88,13 @@ handleLoad(data, ended, pagination) { error事件在查询报错时触发 -``` -@error +``` html +... + +... + handleError(e) { - // {errorMessage} + // {message} } ``` @@ -128,19 +137,18 @@ this.$refs.udb.loadMore() //udb为uni-clientdb组件的ref属性值 模式1:上拉加载上一页。下一页的查询结果会追加合并到data里 ```html -