当前第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中判断变量是否为数字的3种方法(附代码)
javascript怎么禁止缓存
html怎么加入js
javascript怎么删除 tr
对javascript开发者非常有用的10个奇淫巧计
javascript日期格式如何转换成年月日
javascript怎么类型转换
10 种快速优化 web 性能的手段(分享)
原来es6 module还可以这样用!(备忘单)
javascript高阶函数的用法介绍
更多相关阅读请进入《javascript》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » 监听element-ui table滚动事件的代码示例