使用@scroll
<div class='manufacturer-info' @scroll.native="scrollList($event)"></div>
监听
mounted () { document.addEventListener('scroll', this.scrollList, true) }
销毁
beforeDestroy () { document.removeEventListener('scroll', this.scrollList, true) },
滚动处理
// 滚动底部加载更多用户数据 scrollList (e) { this.$nextTick(() => { let el = e.target if (el.scrollHeight - el.clientHeight - el.scrollTop < 30) { this.loadMoreUser() } }) }
本文作者为gengboxb,转载请注明。