移动端滚动到底部加载更多的方法

mounted () {
    window.addEventListener('scroll', this.lazyLoading); // 滚动到底部,再加载的处理事件
},

beforeDestroy () {
     window.removeEventListener('scroll', this.lazyLoading);    //离开页面时移除
}, 
methods:{
     lazyLoading () { // 滚动到底部,再加载的处理事件
         let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
         let clientHeight = document.documentElement.clientHeight;
         let scrollHeight = document.documentElement.scrollHeight;
         if (scrollTop + clientHeight >= scrollHeight) { // 如果滚动到接近底部,自动加载下一页
               //事件处理
         },        
}
原文地址:https://www.cnblogs.com/ruthless/p/9828597.html