From 1696267213783c60b38105fe0a62896f8fa1345e Mon Sep 17 00:00:00 2001 From: handongxun Date: Fri, 6 Aug 2021 18:33:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(unicloud-db=E7=BB=84=E4=BB=B6):=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=20vue2=20nvue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/unicloud-db/unicloud-db.vue | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/uni-components/lib/unicloud-db/unicloud-db.vue b/packages/uni-components/lib/unicloud-db/unicloud-db.vue index 13c1bb3937..ed9eb9c583 100644 --- a/packages/uni-components/lib/unicloud-db/unicloud-db.vue +++ b/packages/uni-components/lib/unicloud-db/unicloud-db.vue @@ -49,6 +49,7 @@ const attrs = [ export default { name: 'UniClouddb', + // #ifdef VUE3 setup(props) { // 单条记录时,使用shallowRef(仅支持赋值修改),列表时,采用ref(支持push等修改) const dataListRef = props.getone ? shallowSsrRef(undefined) : ssrRef([]) @@ -67,6 +68,7 @@ export default { return this.loadData() } }, + // #endif props: { options: { type: [Object, Array], @@ -163,6 +165,9 @@ export default { return { loading: false, hasMore: false, + // #ifndef VUE3 + dataList: [], + // #endif paginationInternal: {}, errorMessage: '' } @@ -174,6 +179,11 @@ export default { size: this.pageSize, count: 0 } + // #ifndef VUE3 + if (this.getone) { + this.dataList = undefined + } + // #endif this.$watch(() => { var al = [] @@ -233,11 +243,13 @@ export default { // #endif }, + // #ifndef VUE3 mounted() { - // if (!this.manual && this.loadtime === loadMode.auto) { - // this.loadData() - // } + if (!this.manual && this.loadtime === loadMode.auto) { + this.loadData() + } }, + // #endif methods: { loadData(args1, args2) { let callback = null -- GitLab