说明1:参考页面为https://www.cnblogs.com/evilliu/articles/6393336.html
说明2:分页代码如下
$('#pageLimit').bootstrapPaginator({ currentPage: _noticePage, //当前需要显示的页面 totalPages: _totalPage, //一次显示多少个页面 size: "large", bootstrapMajorVersion: 3, //bootstrap需要的版本要求 numberOfPages: 8, //一次能显示多少页 itemTexts: function (type, page, current) { switch (type) { case "first": return "首页"; case "prev": return "上一页"; case "next": return "下一页"; case "last": return "末页"; case "page": return page; }//默认显示的是第一页。 }, onPageClicked: function (event, originalEvent, type, page) {//给每个页眉绑定一个事件,其实就是ajax请求,其中page变量为当前点击的页上的数字。 var _prama = gPrama; _prama.page_number = page; _prama = JSON.stringify(_prama); var _res = gRequest.postRemoteDataWithOutToken(gApiKey, "query", _prama); //这里是一个封装好的ajax请求,详情见我文章之ajax封装 _res.done(function (data) { if (data.meta.code == 0) { localStorage.setItem("noticePage",page); $(".left_bottom_ul").empty(); var content = createUI(data.data.list); //create是自动生成li标签的函数,未给出。 $(".left_bottom_ul").append(content); } else { console.log("公告数据请求失败"); } }); } });