From af605c93567de3bf29d448ca26e98881498a3648 Mon Sep 17 00:00:00 2001 From: handongxun Date: Thu, 5 Aug 2021 17:11:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(unicloud-db=E7=BB=84=E4=BB=B6):=20=E8=81=94?= =?UTF-8?q?=E8=A1=A8=E6=97=B6=E8=B0=83=E7=94=A8=20remove/update=20?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/uni-components/lib/unicloud-db/unicloud-db.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/uni-components/lib/unicloud-db/unicloud-db.vue b/packages/uni-components/lib/unicloud-db/unicloud-db.vue index 911fccbfa..13c1bb393 100644 --- a/packages/uni-components/lib/unicloud-db/unicloud-db.vue +++ b/packages/uni-components/lib/unicloud-db/unicloud-db.vue @@ -381,7 +381,7 @@ export default { db = db.action(action) } - return db.collection(this.collection).doc(id).update(value).then((res) => { + return db.collection(this._getCollection()).doc(id).update(value).then((res) => { success && success(res) if (showToast) { uni.showToast({ @@ -528,7 +528,7 @@ export default { exec = exec.action(action) } - exec.collection(this.collection).where({ + exec.collection(this._getCollection()).where({ _id: dbCmd.in(ids) }).remove().then((res) => { success && success(res.result) @@ -552,6 +552,11 @@ export default { complete && complete() }) }, + _getCollection() { + const index = this.collection.indexOf(',') + const collection = index > 0 ? this.collection.substring(0, index) : this.collection + return collection + }, removeData(ids) { const il = ids.slice(0) const dl = this.dataList -- GitLab