DOM层
<el-pagination
layout="prev, pager, next"
:page-size="pageSize"
:total="total"
:current-page="curPage"
@current-change="currentChange"
@prev-click="prevClick"
@next-click="nextClick"
>
</el-pagination>
js层
return{
page:1,
pageSize:2,
total:0,
curPage:0,
}
async currentChange(curPage){
this.curPage = curPage;
let res = await templateListV2Api(curPage,this.pageSize);
if(res.code == '000000'){
this.templateList = res.data.list
this.total = res.data.total
this.templateList.forEach(function(e){
e.roleLineBoxBg = "background-image:url(" + e.bgPath + ") !important;";
})
}
},
async prevClick(curPage){
let res = await templateListV2Api(curPage,this.pageSize);
if(res.code == '000000'){
this.templateList = res.data.list
this.total = res.data.total
this.templateList.forEach(function(e){
e.roleLineBoxBg = "background-image:url(" + e.bgPath + ") !important;";
})
}
},
async nextClick(curPage){
let res = await templateListV2Api(curPage,this.pageSize);
if(res.code == '000000'){
this.templateList = res.data.list
this.total = res.data.total
this.templateList.forEach(function(e){
e.roleLineBoxBg = "background-image:url(" + e.bgPath + ") !important;";
})
}
},