只获取骨干集合中的第20个项目 [英] get only the first 20 items in a backbone collection
本文介绍了只获取骨干集合中的第20个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图渲染仅在backbonejs集合中的第20个项目。
I'm trying to render only the first 20 items in a backbonejs collection.
如果集合是一个数组我会做_.first(收集,20)。但由于它不是它不工作。我怎么把它限制在20?谢谢你。
If the collection was an array I would do _.first(collection, 20). But since it's not it doesn't work. How do I limit it to 20? Thanks.
推荐答案
骨干收藏有下划线的方法内置一>:
Backbone collections have underscore methods builtin:
collection.first(20)
这篇关于只获取骨干集合中的第20个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文