提交 86e99534 编写于 作者: d-u-a's avatar d-u-a

update: unicloud-db, add、update、remove方法移除副表

上级 18a7eef8
......@@ -314,7 +314,7 @@ export default {
db = db.action(action)
}
db.collection(this.collection).add(value).then((res) => {
db.collection(this._getCollection()).add(value).then((res) => {
success && success(res)
if (showToast) {
uni.showToast({
......@@ -388,7 +388,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({
......@@ -546,9 +546,7 @@ export default {
exec = exec.action(action)
}
const collection = this.collection.indexOf(',') > 0 ? this.collection.substring(0, this.collection.indexOf(',')) : this.collection
exec.collection(collection).where({
exec.collection(this._getCollection()).where({
_id: dbCmd.in(ids)
}).remove().then((res) => {
success && success(res.result)
......@@ -572,6 +570,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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册