这是我所拥有的:
ProductListView.js
define(['jquery', 'underscore', 'backbone', 'views/ProductView', 'views/PaginatorView'], function($, _, Backbone, ProductView, PaginatorView) {
var ProductListView = Backbone.View.extend({
className: 'productsList',
initialize: function() {
this.render();
},
render: function() {
// some initialization
// that's for zurb grid
this.$el.addClass('twelve columns');
for(var i = startPos; i < endPos; i++) {
this.$el.append(new ProductView({ model: products[i] }).render().el);
}
this.$el.append(new PaginatorView({ model: this.model, page: this.options.page }).render().el);
// this.$el.after(new PaginatorView({ model: this.model, page: this.options.page }).render().el);
return this;
}
});
return ProductListView;
});
似乎我不能在this.$el
. 线
this.$el.after(new PaginatorView({ model: this.model, page: this.options.page }).render().el);
虽然可以PaginatorView
在 ( ProductListView
) 视图内部附加,但似乎不可能在其外部插入一些东西。
你遇到过这样的事情吗?