当前第2页 返回上一页
绑定监听事件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | mounted() {
this.dom = this. $refs .table.bodyWrapper
this.dom.addEventListener( 'scroll' , () => {
let scrollTop = this.dom.scrollTop
let windowHeight = this.dom.clientHeight || this.dom.clientHeight
let scrollHeight = this.dom.scrollHeight || this.dom.scrollHeight
if (scrollTop + windowHeight === scrollHeight) {
if (!this.allData) this.getMoreLog()
console.log( 'scrollTop' , scrollTop + 'windowHeight' , windowHeight + 'scrollHeight' , scrollHeight)
}
})
}
|
获取到新的数据后,调整滚动条的位置
1 2 3 4 5 | getMoreLog() {
...
this.dom.scrollTop = this.dom.scrollTop - 100
...
}
|
结语:至此我们已经完成了对table的绑定!
本篇文章到这里就已经全部结束了,更多其他精彩内容可以关注PHP中文网的JavaScript视频教程栏目!
以上就是监听element-ui table滚动事件的代码示例的详细内容,更多文章请关注木庄网络博客!
返回前面的内容
相关阅读 >>
详细了解javascript中的延迟加载
聊聊javascript人脸识别技术
javascript是啥
javascript对象的定义方法有哪些
javascript怎么设置元素居中
javascript为什么没有权限
javascript如何实现跳转新页面
五个超好用的array.from()用途(详解)
angular实现只执行正在开发的新单元测试
javascript怎么移除li
更多相关阅读请进入《javascript》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » 监听element-ui table滚动事件的代码示例