亲测有效!
实现:在每一次切换后将页码置为1;在当前页自由切换页码。
- 使用:current-page.sync
<el-pagination
class="tc mg"
:current-page.sync="filter.page"
:page-sizes="[10, 20, 100, 200]"
:page-size="filter.per_page"
layout="total, sizes, prev, pager, next, jumper"
:total="total_rows"
@size-change="pageSizeChange"
@current-change="pageCurrentChange"
></el-pagination>
2.在搜索函数之前将页码置为1
search(){
this.filter.page = 1;
...
}
- pageCurrentChange函数
pageCurrentChange(val) {
this.filter.page = val;
this.search();
}```