【发布时间】:2017-09-12 11:41:50
【问题描述】:
我在 Meteor 中使用 ReactJS 为 UI 创建应用程序。我遇到了一个问题。我正在尝试从流星集合中读取数据并用一些数据填充网格,我已经设法实现了这一点,但我似乎无法弄清楚如何进行无限滚动/分页。
我偶然发现了paginate-subscriptionsmeteor 包,但我似乎无法让它正常工作。
这是我的代码:
Container = React.createClass({
mixins: [ReactMeteorData],
getMeteorData() {
var handle = Meteor.subscribeWithPagination('my-coll', 10);
return {
items: MyCollection.find({}).fetch()
},
render() {
return (
<div>
{this.data.items.map(item => {
<p>{item}</p>
}}
</div>
)
}
})
它不会渲染 10 个项目,而是渲染集合中的所有项目,这不是我想要的。
帮助表示赞赏。
【问题讨论】: