获取到以后元素,而后获取以后元素的高度、滚动条间隔顶部高度,滚条高度,从而进行判断。
代码如下:
that.$nextTick(() => { const el = document.querySelector('.reg-pro-wrap'); const offsetHeight = el.offsetHeight; el.onscroll = () => { const scrollTop = el.scrollTop; const scrollHeight = el.scrollHeight; if ((offsetHeight + scrollTop) - scrollHeight >= -1) { // 须要执行的代码 console.log('已滚动到底部') that.disabled = false; } };});