perf: 翻页后滚动条置顶
This commit is contained in:
@@ -56,21 +56,34 @@ export default {
|
|||||||
//点击上一页箭头
|
//点击上一页箭头
|
||||||
prev() {
|
prev() {
|
||||||
this.backgroundColor();
|
this.backgroundColor();
|
||||||
|
this.scrollbarToTop();
|
||||||
},
|
},
|
||||||
//点击下一页箭头
|
//点击下一页箭头
|
||||||
next(val) {
|
next(val) {
|
||||||
this.backgroundColor();
|
this.backgroundColor();
|
||||||
|
this.scrollbarToTop();
|
||||||
},
|
},
|
||||||
//currentPage 改变时会触发
|
//currentPage 改变时会触发
|
||||||
current(val) {
|
current(val) {
|
||||||
this.$emit("pageNo", val);
|
this.$emit("pageNo", val);
|
||||||
this.backgroundColor();
|
this.backgroundColor();
|
||||||
|
this.scrollbarToTop();
|
||||||
},
|
},
|
||||||
size(val) {
|
size(val) {
|
||||||
this.pageObj.pageNo=1;
|
this.pageObj.pageNo=1;
|
||||||
this.$emit("pageSize", val);
|
this.$emit("pageSize", val);
|
||||||
this.backgroundColor();
|
this.backgroundColor();
|
||||||
},
|
},
|
||||||
|
scrollbarToTop() {
|
||||||
|
this.$nextTick(() => {
|
||||||
|
let wraps = document.querySelectorAll(".el-table__body-wrapper");
|
||||||
|
wraps.forEach(wrap => {
|
||||||
|
if (wrap._ps_) {
|
||||||
|
wrap.scrollTop = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
resetPageSizes:function(){
|
resetPageSizes:function(){
|
||||||
if(this.postPageSizes){
|
if(this.postPageSizes){
|
||||||
this.pageSizes=this.postPageSizes.map((item)=>{
|
this.pageSizes=this.postPageSizes.map((item)=>{
|
||||||
@@ -83,7 +96,6 @@ export default {
|
|||||||
this.list = this.$refs.page.$el.children[2].children;
|
this.list = this.$refs.page.$el.children[2].children;
|
||||||
for (let i = 0; i < this.list.length; i++) {
|
for (let i = 0; i < this.list.length; i++) {
|
||||||
const element = this.list[i];
|
const element = this.list[i];
|
||||||
//console.info(element)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -97,10 +109,6 @@ export default {
|
|||||||
this.pageSize=parseInt(pageSize);
|
this.pageSize=parseInt(pageSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.$nextTick(() => {
|
|
||||||
// let input = document.querySelector(".el-pagination .el-select .el-input__inner");
|
|
||||||
// input.value = this.pageSize + this.$t('pageSize');
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
postPageSizes:{
|
postPageSizes:{
|
||||||
|
|||||||
Reference in New Issue
Block a user