【发布时间】:2018-05-31 21:27:25
【问题描述】:
我正在努力为我的论坛添加分页。你能帮帮我吗?基本上,我希望在我的论坛页面上只能看到 10 个帖子。但它正在返回所有这些。 “加载更多”按钮也没有任何作用(看起来)。
我正在使用这个包:Paginated Subscription
这是我正在使用的代码:
if (Meteor.isClient) {
Deps.autorun(function() {
var handle = Meteor.subscribeWithPagination('posts',10);
});
Template.postsList.helpers({
'posts': function(){
return Posts.find({});
}
});
Template.postsList.events({
'click .btn': function(){
handle.loadNextPage();
}
})
}
if (Meteor.isServer) {
Meteor.startup(function () {
Meteor.publish("posts", function(limit){
return Posts.find({}, {limit: limit});
});
});
}
【问题讨论】:
标签: meteor pagination