VUE 滚动到底部加载更多

517 阅读1分钟
mounted() {  
      window.addEventListener('scroll', this.handleScroll, true);
},
destroyed() {
    window.removeEventListener('scroll', this.handleScroll);
},
 methods: {
    /**
     * [handleScroll description]滚动到底部
     *
     * @param   {[type]}  e  [e description]
     *
     * @return  {[type]}     [return description]
     */
    handleScroll(e) {
        if (e.target.scrollTop + e.target.clientHeight >= e.target.scrollHeight) {
            //在此处放入你的加载更多方法
        }
    },
}