【发布时间】:2015-03-10 14:29:15
【问题描述】:
我有一组我提供给我的 CompositeView 的集合。 对于每个集合,我试图显示一个矩形,并在其中显示该集合的前 3 个模型。
由于每个集合可能有 3 个以上的模型,我想将其缩减为始终为 3 个或更少。我正在使用 mustache,所以我不能在那里做,所以我想在 serializeData 中为 childView 或 Show.Item 做,但我很困惑,我不了解 serializeData 函数的上下文。当我查看this 时,它给了我窗口对象。
我应该在哪里进行过滤?
collection 1
collection 1
model 1
model 2
model 3
collection 2
model 1
model 2
model 3
model 4
new Show.Items
collection: collection
class Show.Item extends App.Views.ItemView
template: "templates/_item"
class Show.Items extends App.Views.CompositeView
template: "templates/show"
childView: Show.Item
childViewContainer: '.items'
【问题讨论】:
标签: backbone.js marionette mustache