猫鼬-Nodejs页面分页

问题描述 投票:1回答:1

嗨,我想用Model.find {}方法制作一个分页系统。

我将在索引文件中对页面进行分页。

这是我的app.js代码:

    app.get('/', function (req, res) {
      Article.find({}, { skip: 10, limit: 5 }, function(err, articles){
          if(err){
              console.log(err)
          }else{
            res.render('index',{
                articles:articles
            });
        }
    });
    })

;

这是我索引的代码:

extends layout

    block content
      body
        br 
        br
        br
        .container
          ul.list-group
            each article, i in articles
              li.list-group-item
                a(href="/article/" + article._id)= article.baslik

我无法处理分页。我陷入了后端,并在前端中实现了它。你能帮我吗?每个答案将不胜感激。

node.js mongodb express mongoose pagination
1个回答
0
投票

使用此示例进行分页,您只需在前端`''http://codepen.io/PiotrBerebecki/pen/pEYPbY]中实现它即可>


© www.soinside.com 2019 - 2024. All rights reserved.