为什么事件"改变"适用于模型评论1?如何解决?如果我删除行('评论':[]), 事件'变化'不行。 我明白这是因为我使用数组,但我需要使用它,但我没有事件,如果他没有改变。感谢/
创建新集合
var commentCollection = new VPRS.Comment.CommentCollection([
{
"id": "comment1",
"questionId": "post1",
"name": "Alex",
"text": "text 1",
"comment":[]
},
{
"id": "comment2",
"questionId": "post1",
"name": "Alex",
"text": "Text2"
}
]);
----------
json = [
{
"id": "comment1",
"questionId": "post1",
"name": "Alex",
"text": "text 1",
"comment":[]
},
{
"id": "comment2",
"questionId": "post1",
"name": "Alex",
"text": "Text2"
}]
--------------
wallItemCollection.on('change', function (model) {
console.log('model change')
}
------------
wallItemCollection.fetch({
update: true,
merge: true,
success: function () {
console.log('fetch compleate')
}
});