fix: 修复同页面内有俩top按钮时置顶错误的问题
This commit is contained in:
@@ -184,7 +184,7 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<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>
|
||||
|
||||
<!-- 副列表 endpoint query-->
|
||||
@@ -285,7 +285,7 @@
|
||||
width="180">
|
||||
</el-table-column>
|
||||
</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>
|
||||
|
||||
|
||||
@@ -80,6 +80,18 @@ Vue.prototype.toTop = (type, wrap) => { //top按钮公共方法
|
||||
}, 20);
|
||||
} else {
|
||||
let els = document.querySelectorAll(".el-table__body-wrapper");
|
||||
if (wrap || wrap == 0) {
|
||||
let currentTop = els[wrap].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[wrap].scrollTop = currentTop;
|
||||
}
|
||||
}, 20);
|
||||
} else {
|
||||
for (let i = 0; i < els.length; i++) {
|
||||
let currentTop = els[i].scrollTop;
|
||||
let interval = currentTop/10;
|
||||
@@ -93,6 +105,7 @@ Vue.prototype.toTop = (type, wrap) => { //top按钮公共方法
|
||||
}, 20);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Vue.prototype.gutterHandler = (tableClass) => {
|
||||
setTimeout(() => {
|
||||
|
||||
Reference in New Issue
Block a user