diff --git a/packages/uni-components/lib/unicloud-db/unicloud-db.vue b/packages/uni-components/lib/unicloud-db/unicloud-db.vue index 911fccbfa109d9d673b9fa9755f0558e2502d982..13c1bb3937a488e269c18aa113e335feb62d846e 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