elmentui 分页组件pagination遇到的问题,就是初始的current-page设置无效,进入页面后一直是在第1页,其实我默认设置跳转到第2页的。(。具体如下:
<div class="pagination"> <el-pagination background layout="total,prev, pager, next" :current-page="currentPage" :page-size="pageSize" :total="total"> </el-pagination> </div>
组件里的data:
data:function() { return { flowDatas:[{}], pageSize:15, currentPage:2, total:0, }
组件里methods:
async initData() { let r = await getFlowList({currentPage:this.curPage,pageSize:this.pageSize}); let res = r.data; console.log(res); if(!Object.is(res.statusCode,200)) { this.$message.error("获取流程列表信息失败!") }else { let data = res.data; this.flowDatas = data.rows; this.total = data.totalCount; //this.currentPage = 5; 如果加上这句,就会跳转到第5页 } }
PIPIONE
相关分类