上拉刷新

1.引入vue,加载监听事件javascript

methods: { 
                handleScroll(){
                    let page = document.getElementById('content');
                    // console.log(page.scrollTop,page.clientHeight,page.scrollHeight);
                    if(page.scrollTop+page.clientHeight >= page.scrollHeight-10){
                        this.more = '加载中...';
                        setTimeout(()=>{
                                this.more = '';
                            },1000)
                    } else {
                        this.more = '上拉加载更多...';
                    }
                }
            },
            mounted(){
                document.getElementById('content').addEventListener('scroll',this.handleScroll);
            },
            beforeDestroy(){
                document.getElementById('content').removeEventListener('scroll', this.handleScroll);
            }

二、第三方:MUI-最接近原生APP体验的高性能前端框架前端

http://dev.dcloud.net.cn/mui/vue

相关文章
相关标签/搜索