el-table表格组件部分代码
watch: {
//监听滚动
tableDom (newVal) {
if (newVal) {
this.tableDom = newVal
this.tableDom.addEventListener('scroll', (res) => {
let height = res.target;
let clientHeight = height.clientHeight;
let scrollTop = height.scrollTop;
let scrollHeight = height.scrollHeight;
if (clientHeight + scrollTop + 585 > scrollHeight) {
// 请求下一页
this.currentPages = this.currentPages + 1
if (this.currentPages < this.totalPage) {
this.$emit('getProvidersTableData', this.currentPages);
}
}
}, true);
};
}
},
//组件被打开的方法
dialogOpen () {
this.dialogVisible = true
// 将已选择的人员在表格中勾选
this.$nextTick(() => {
//获取table节点
this.tableDom = this.$refs.ProvidersTable.bodyWrapper
})
},