feat:部分代码去除事件监听
This commit is contained in:
@@ -332,6 +332,19 @@
|
||||
this.$set(this.searchLabel, "orderBy", orderBy);
|
||||
this.getTableData();
|
||||
},
|
||||
plpsscrolly(el,self){
|
||||
if (el._ps_.scrollbarYTop > 50) {
|
||||
self.tools.showTopBtn = true;
|
||||
} else {
|
||||
self.tools.showTopBtn = false;
|
||||
}
|
||||
},
|
||||
plmouseenter(self){
|
||||
self.tools.tableHover = true;
|
||||
},
|
||||
plmouseleave(self){
|
||||
self.tools.tableHover = false;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
//初始化表头
|
||||
@@ -350,19 +363,9 @@
|
||||
//绑定滚动条事件,控制top按钮
|
||||
let el = this.$refs.modelTable.$el.querySelector(".el-table__body-wrapper");
|
||||
if (el._ps_) {
|
||||
el.addEventListener("ps-scroll-y", () => {
|
||||
if (el._ps_.scrollbarYTop > 50) {
|
||||
this.tools.showTopBtn = true;
|
||||
} else {
|
||||
this.tools.showTopBtn = false;
|
||||
}
|
||||
});
|
||||
el.addEventListener("mouseenter", () => {
|
||||
this.tools.tableHover = true;
|
||||
});
|
||||
el.addEventListener("mouseleave", () => {
|
||||
this.tools.tableHover = false;
|
||||
});
|
||||
el.addEventListener("ps-scroll-y", this.plpsscrolly.bind('',el,this));
|
||||
el.addEventListener("mouseenter", this.plmouseenter.bind('',el,this));
|
||||
el.addEventListener("mouseleave", this.plmouseleave.bind('',el,this));
|
||||
}
|
||||
});
|
||||
},
|
||||
@@ -371,6 +374,14 @@
|
||||
let vm = this;
|
||||
this.$bottomBoxWindow.showSubListWatch(vm, n);
|
||||
},
|
||||
},
|
||||
beforeDestroy(){
|
||||
let el = this.$refs.promTable.$el.querySelector(".el-table__body-wrapper");
|
||||
if (el._ps_) {
|
||||
el.removeEventListener("ps-scroll-y", this.plpsscrolly.bind('',el,this));
|
||||
el.removeEventListener("mouseenter", this.plmouseenter.bind('',el,this));
|
||||
el.removeEventListener("mouseleave", this.plmouseleave.bind('',el,this));
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user