elementui eltable,查询数据后默认返回第一页数据

一 场景


场景是默认数据有30页, 这个时候你切换到30页,再次加搜索条件查询你的currentPage会变为当前数据最后一页,但是查询字段还是30页

二 解决办法
我会在confirm查询时候将页数调回到第一页, 同时监听page分页组件中的currenpage回到第一页,

这一步完成查询数据是第一页的数据

queryData(query) {
this.query = query
this.pageChange(1)
this.getList()
},
pageChange(val) {
this.currentPage = val
this.getList()
},
 这一步将page分页组件中的currentpage页设置为第一页

watch: {
currentPage: {
handler() {
this.current = this.currentPage
},
deep: true,
},
},
解决


————————————————
版权声明:本文为CSDN博主「sunnyboysix」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/sunnyboysix/article/details/111287437

原文地址:https://www.cnblogs.com/javalinux/p/14811803.html