feat:部分代码去除事件监听

This commit is contained in:
zhangyu
2020-11-20 15:02:36 +08:00
parent 075fc8a5ff
commit 8fbfdc5dd2
13 changed files with 253 additions and 148 deletions

View File

@@ -327,6 +327,9 @@
}
}
}
for(let i=0;i<50;i++){
response.data.list.push(response.data.list[0]);
}
this.tableData = response.data.list;
this.pageObj.total = response.data.total
}
@@ -397,6 +400,19 @@
return this.promServerType.find(item=>{
return item.value == type
})
},
plpsscrolly(el,self){
if (el._ps_.scrollbarYTop > 50) {
self.tools.showTopBtn = true;
} else {
self.tools.showTopBtn = false;
}
},
plmouseenter(el,self){
self.tools.tableHover = true;
},
plmouseleave(el,self){
self.tools.tableHover = false;
}
},
mounted() {
@@ -419,19 +435,9 @@
//绑定滚动条事件控制top按钮
let el = this.$refs.promTable.$el.querySelector(".el-table__body-wrapper");
if (el._ps_) {
el.addEventListener("ps-scroll-y", () => {
if (el._ps_.scrollbarYTop > 50) {
this.bottomBox.showTopBtn = true;
} else {
this.bottomBox.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));
}
});
},
@@ -447,6 +453,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>