add方法会替换当前数组中全部内容,而不是在数组末尾增加一个值
代码如下
let post = AV.Object.createWithoutData('Post', id)
let comment = new AV.Object('Comment')
let text = '123'
comment.set('text', text)
post.add('comments', comment)
post.save().then(function(res){
console.log(res.toJSON())
}).catch(function(error){
console.log(error)
})
返回的数组中永远只有一条数据
[
{
"__type": "Pointer",
"className": "Comment",
"objectId": "58fda8be8d6d8100589bc973"
}
]
不知道是不是我使用方法有问题?
-
创建时间
17年4月24日
-
最后回复
17年4月25日
-
4
回复
-
1.3K
浏览
-
2
用户
-
1
链接