목록에서 편지를 클릭하여 다른 모음을 가져 오는 Backbone App이 있습니다. 그래서 Progressbar 나 어떤 종류의 회전 이미지를 추가하고 싶습니다. 그러나 이것을 수행하는 방법을 모릅니다.BackboneJS - 컬렉션을 가져 오는 동안 진행률 막대를 추가하는 방법
내보기 그래서 사람이 어떻게 이렇게하는 아이디어가 않습니다이
function (App, Backbone) {
var Artists = App.module();
var ArtistView = Backbone.View.extend({
tagName : 'li',
template: 'artistItem',
serialize: function() {
var data = this.model.toJSON();
data.letter = this.model.collection.letter;
return data;
},
});
Artists.View = Backbone.View.extend({
tagName : 'ul',
className : 'artistList',
initialize: function() {
this.listenTo(this.collection, 'all', this.render);
this.listenTo(App, 'navigateLetter', this.updateState);
},
beforeRender: function() {
var self = this;
this.collection.each(function(item) {
self.insertView(new ArtistView({model: item}))
})
},
updateState: function(letter) {
this.collection.letter = letter;
this.stopListening(this.collection);
this.collection.fetch();
this.listenTo(this.collection, 'all', this.render);
}
});
Artists.ArtistsCollection = Backbone.Collection.extend({
url: function() {
return '/projects/mdk/index.php/api/artists/' + this.letter;
}
});
return Artists;
});
처럼 보인다? 초기화 또는 beforeRender에서 뭔가를해야한다고 생각할 수 있습니까? 사전