el-table表格实现自动滚动效果

实现方式:

先给el-table一个ref属性 然后获取到这个属性 在mounted阶段执行scrollFun函数,通过setTnterval定时器来实现动态滚动效果,代码如下:

mounted()
this.fullscreenHight1()window.addEventListener( 'resize',() => 
this.renderHeight1()
)}
const table = this .$refs .table
const tableRight = this.$refs .tableRight
this.scrollFun(tableRight)
this.scrollFun(table)

}

scrollFun(ref) {
const divData = ref.bodywrapperthis.timer = setInterval(() => 
divData.scrollTop += 1if (divData.clientHeight + divData.scrollTop === divData,scrollHeight) divData.scrollTop = 0
}
},50)
}

你可能感兴趣的:(vue.js,elementui,前端)