在vue中如何判断滚动条到达底部
mounted(){//在生命周期函数mounted中console.log(this.$refs.veriface,'智能切分滚动组件实例')//具有滚动条的dom元素,this.$refs.veriface.addEventListener('scroll', (e)=>{// console.log(e,'滚动条滚动触发')var scrollTop = e.target.scroll
·
mounted(){//在生命周期函数mounted中
console.log(this.$refs.veriface,'智能切分滚动组件实例')//具有滚动条的dom元素,
this.$refs.veriface.addEventListener('scroll', (e)=>{
// console.log(e,'滚动条滚动触发')
var scrollTop = e.target.scrollTop
var windowHeight = e.target.clientHeight
var scrollHeight = e.target.scrollHeight
console.log(scrollTop,windowHeight,scrollHeight,'123')
if(scrollTop+windowHeight == scrollHeight){
// 当前滚动条已经触底
this.isNoMore = true
} else {
this.isNoMore = false
}
});
},
更多推荐
已为社区贡献7条内容
所有评论(0)