<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="../static/css/jquery.pagination.css">
<script src="../static/js/jquery-1.12.4.min.js"></script>
<script src="../static/js/jquery.pagination.min.js"></script>
</head>
<body>
<table border="1">
{% for u in data.user_list %}
<tr>
<td>{{ loop.index }}</td>
<td>{{ u.user_name }}</td>
</tr>
{% endfor %}
</table>
<div class="box">
<div id="pagination" class="page"></div>
</div>
<script>
$(function() {
$("#pagination").pagination({
// data.current_pag 当前页
currentPage: {{data.current_page}},
// data.total_page 总页数
totalPage: {{data.total_page}},
// 点击页码所执行的函数
callback: function(cur) {
window.location.href="/?page="+cur
}
});
});
</script>
</body>
</html>
转载于:https://www.cnblogs.com/Jacky-WYQ/p/10915694.html