我有一个很长的视频列表,我已将延迟加载添加到此列表中:
//file videos.js
loadMore: function(){
this.fetch({
add: true, //add to collection
data: {
limit: this.limit,
offset: this.offset
}
});
this.offset += this.limit;
}
此提取会触发 View 的 add
事件。
//file videosView.js
initialize : function() {
collection.bind('add', this.addVideo, this);
},
addVideo: function() {
//how can I get the added models?
},
在 View 中,如何获取添加的模型?
最佳答案
只需在您的添加回调函数中请求它:
addVideo: function(video) {
// the model that was added is in the video variable
}
关于javascript - 延迟加载集合时如何获取获取的模型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8561527/