principle:
Add a method to jump to the top of the page when the elementUI paging component triggers an event when switching pages (here, the handleCurrentChange function).
accomplish:
<!-- 分页组件 -->
<el-pagination
@current-change="handleCurrentChange"
>
</el-pagination>
//跳到页顶
scrollTop(selector) {
let element = selector && document.querySelector(selector) || window;
element.scrollTo(0, 0);
},
handleCurrentChange(val) {
...
this.scrollTop()
}