perf: 滚动条替换和toTop替换
This commit is contained in:
@@ -33,7 +33,6 @@
|
||||
border style="width: 100%;"
|
||||
ref="modelTable"
|
||||
class="nz-table"
|
||||
v-scrollBar:el-table="'large'"
|
||||
v-loading="tools.loading"
|
||||
:cell-class-name="assetStatClassName"
|
||||
v-show="bottomBox.mainResizeShow"
|
||||
@@ -89,7 +88,7 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<button class="to-top" :style="{top: tools.toTopBtnTop}" :class="{'to-top-is-hover': tools.tableHover}" v-show="tools.showTopBtn" @click="$toTop('ps', 0)"><i class="nz-icon nz-icon-top"></i></button>
|
||||
<button :class="{'to-top-is-hover': tools.tableHover}" :style="{top: tools.toTopBtnTop}" @click="toTop(scrollWrap)" class="to-top" v-show="tools.showTopBtn"><i class="nz-icon nz-icon-top"></i></button>
|
||||
<div class="pagination-bottom" v-show="!bottomBox.showSubList">
|
||||
<Pagination :tableId="tableId" :pageObj="pageObj" @pageNo='pageNo' @pageSize='pageSize' ref="Pagination"></Pagination>
|
||||
</div>
|
||||
@@ -204,6 +203,7 @@
|
||||
}],
|
||||
},
|
||||
searchLabel: {}, //搜索参数
|
||||
scrollWrap: null,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -285,7 +285,13 @@
|
||||
this.tools.loading = false;
|
||||
if (response.code === 200) {
|
||||
this.tableData = response.data.list;
|
||||
this.pageObj.total = response.data.total
|
||||
this.pageObj.total = response.data.total;
|
||||
if (!this.scrollWrap) {
|
||||
this.$nextTick(() => {
|
||||
this.scrollWrap = this.$refs.modelTable.bodyWrapper;
|
||||
this.toTopBtnHandler(this.scrollWrap);
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -330,15 +336,6 @@
|
||||
this.$set(this.searchLabel, "orderBy", orderBy);
|
||||
this.getTableData();
|
||||
},
|
||||
plpsscrolly(el,self){
|
||||
if (el._ps_.scrollbarYTop > 50) {
|
||||
self.tools.showTopBtn = true;
|
||||
self.tools.tableHover = true;
|
||||
} else {
|
||||
self.tools.showTopBtn = false;
|
||||
self.tools.tableHover = false;
|
||||
}
|
||||
},
|
||||
},
|
||||
created(){
|
||||
//是否存在分页缓存
|
||||
@@ -355,13 +352,6 @@
|
||||
this.tableTitleReset(this.tableTitle,this.tools.customTableTitle);
|
||||
|
||||
this.getTableData();
|
||||
this.$nextTick(() => {
|
||||
//绑定滚动条事件,控制top按钮
|
||||
let el = this.$refs.modelTable.$el.querySelector(".el-table__body-wrapper");
|
||||
if (el._ps_) {
|
||||
el.addEventListener("ps-scroll-y", this.plpsscrolly.bind('',el,this));
|
||||
}
|
||||
});
|
||||
},
|
||||
watch: {
|
||||
'bottomBox.showSubList': function(n) {
|
||||
@@ -369,12 +359,8 @@
|
||||
this.$bottomBoxWindow.showSubListWatch(vm, n);
|
||||
},
|
||||
},
|
||||
beforeDestroy(){
|
||||
let el = this.$refs.modelTable.$el.querySelector(".el-table__body-wrapper");
|
||||
if (el._ps_) {
|
||||
el.removeEventListener("ps-scroll-y", this.plpsscrolly.bind('',el,this));
|
||||
el._ps_.destroy();
|
||||
}
|
||||
beforeDestroy() {
|
||||
this.scrollbarWrap.removeEventListener('scroll', bus.debounce);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user