fix: 修复同页面内有俩top按钮时置顶错误的问题
This commit is contained in:
@@ -184,7 +184,7 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<Pagination v-show="mainResizeShow" :tableId="tableId" v-cloak :pageObj="endpointPageObj" @pageNo='endpointPageNo' @pageSize='endpointPageSize' ref="endpointPagination"></Pagination>
|
<Pagination v-show="mainResizeShow" :tableId="tableId" v-cloak :pageObj="endpointPageObj" @pageNo='endpointPageNo' @pageSize='endpointPageSize' ref="endpointPagination"></Pagination>
|
||||||
<button class="to-top" v-show="showTopBtn1" @click="toTop"><i class="nz-icon nz-icon-top"></i></button>
|
<button class="to-top" v-show="showTopBtn1" @click="toTop('ps', 0)"><i class="nz-icon nz-icon-top"></i></button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 副列表 endpoint query-->
|
<!-- 副列表 endpoint query-->
|
||||||
@@ -285,7 +285,7 @@
|
|||||||
width="180">
|
width="180">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
<button class="to-top" v-show="showTopBtn2" @click="toTop"><i class="nz-icon nz-icon-top"></i></button>
|
<button class="to-top" v-show="showTopBtn2" @click="toTop('ps', 1)"><i class="nz-icon nz-icon-top"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -80,17 +80,30 @@ Vue.prototype.toTop = (type, wrap) => { //top按钮公共方法
|
|||||||
}, 20);
|
}, 20);
|
||||||
} else {
|
} else {
|
||||||
let els = document.querySelectorAll(".el-table__body-wrapper");
|
let els = document.querySelectorAll(".el-table__body-wrapper");
|
||||||
for (let i = 0; i < els.length; i++) {
|
if (wrap || wrap == 0) {
|
||||||
let currentTop = els[i].scrollTop;
|
let currentTop = els[wrap].scrollTop;
|
||||||
let interval = currentTop/10;
|
let interval = currentTop/10;
|
||||||
let intervalFunc = setInterval(function(){ //花200ms分10次回到顶部,模拟动画效果
|
let intervalFunc = setInterval(function(){ //花200ms分10次回到顶部,模拟动画效果
|
||||||
if (currentTop == 0) {
|
if (currentTop == 0) {
|
||||||
clearInterval(intervalFunc);
|
clearInterval(intervalFunc);
|
||||||
} else {
|
} else {
|
||||||
currentTop = (currentTop - interval) < interval*0.5 ? 0 : currentTop - interval;
|
currentTop = (currentTop - interval) < interval*0.5 ? 0 : currentTop - interval;
|
||||||
els[i].scrollTop = currentTop;
|
els[wrap].scrollTop = currentTop;
|
||||||
}
|
}
|
||||||
}, 20);
|
}, 20);
|
||||||
|
} else {
|
||||||
|
for (let i = 0; i < els.length; i++) {
|
||||||
|
let currentTop = els[i].scrollTop;
|
||||||
|
let interval = currentTop/10;
|
||||||
|
let intervalFunc = setInterval(function(){ //花200ms分10次回到顶部,模拟动画效果
|
||||||
|
if (currentTop == 0) {
|
||||||
|
clearInterval(intervalFunc);
|
||||||
|
} else {
|
||||||
|
currentTop = (currentTop - interval) < interval*0.5 ? 0 : currentTop - interval;
|
||||||
|
els[i].scrollTop = currentTop;
|
||||||
|
}
|
||||||
|
}, 20);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user