html
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" layout="total, sizes,prev, pager, next,jumper" :page-size="listQuery.pageSize" :page-sizes="[5,10,15]" :current-page.sync="listQuery.pageNum" :total="total"> </el-pagination>
created
let storage = window.sessionStorage; let currentPage = storage.getItem('productPage'); if(currentPage){this.listQuery.pageNum = Number(currentPage)};
storage.removeItem('productPage');//使用后删除,否则从其他页面进来也不一定是第一页
获取列表的函数后面
let storage = window.sessionStorage; storage.setItem('productPage',this.listQuery.pageNum);
转载请注明:有爱前端 » vue+element-ui项目的分页,返回默认显示第一页的问题