使用了 bootstrap 的分页 class ,具体看gist
topics = Topic.query.paginate(page,app.config['PER_PAGE'],error_out=True)
{% from 'paginate.html' import paginate %} {{ paginate(topics,'topic.topic') }}
如果含参数
{{ paginate(topics,'topic.topic',dict(tag=tag) }}
![]() | 1 nowbear 2016-05-29 10:59:02 +08:00 via Android 感谢分享 |
![]() | 2 Akarin 2016-05-29 12:29:52 +08:00 亮点在那里? |
![]() | 3 ibigbug 2016-05-29 14:58:43 +08:00 每页展示 38 条怎么办? |
![]() | 6 ibigbug 2016-05-30 12:19:47 +08:00 ![]() 要重新部署? |
![]() | 7 honmaple OP ![]() 改一下就行,用不了几分钟,使用 PER_PAGE 的话以后容易修改,你也可以直接 topics = Topic.query.paginate(page,38,error_out=True) |
![]() | 8 ibigbug 2016-05-31 20:22:19 +08:00 应该写到 querystring 由用户传进来 |
![]() | 10 ibigbug 2016-06-02 00:28:44 +08:00 `def pager(page=1, per_page=10):` |