jquery中添加分页器
1.html部分添加元素
<div id="portal_paginational"><!-- 这里显示分页 --></div>
2.js部分 fenye里面的数据是要传的数据
var marketShow = {
data: {
trainTypeId: '',
status: -1,
sort: '',
total:0
},
fenye:{
voteId:"",
currentPage: 1,
lineSize: 8,
},
id: '',
3.接口部分 (接口调用成功后在complete里面写分页器)
getWork() {
let id = marketShow.geturlId('id')
var html = ''
$.ajax({
url: API + "/front/composition/PageComposition",
type: "GET",
data:this.fenye,
success: function(res) {
marketShow.data.total = res.totalCount;
if(res.totalCount <12){
$('#portal_paginational').hide()
}
if(res.data.length == 0) {
html += '<div class="lose" style=" width:1000px;height:400px;text-align: center;margin: auto;">' +
'<img src="../../../WebUI/img/lose_text_03.png" style="width: 100%;"/>' +
'</div>';
$('#firstUls').html(html);
} else {
$.each(res.data, function(i, item) {
// comCover
var comCover = IMGPATH + item.comCover;
html += `<li οnclick='toThree("`+ item.id +`")'>` +
'<img src=" '+ comCover +' " alt="">' +
'<p class="name">'+ item.comName +'</p>' +
'<p class="times">浏览量: '+ item.comView +'&