baozhengrui

导航

滚动调用接口获取数据

 <div @scroll="handleScroll">

</div>

handleScroll(event){
            const {scrollTop,clientHeight,scrollHeight} = event.target
            console.log('sssss', scrollTop, clientHeight, scrollHeight)
            if (scrollTop + clientHeight >= scrollHeight){
                this.page.pageNumber += 1
                postAction('url', this.page).then(res => {
                    console.log('时间线', res)
                    var var1 = res.data.data.items
                    this.data = this.data.concat(var1)
                    console.log('this.datqa',this.data)
                })
            }

        },

posted on 2024-08-12 15:03  芮艺  阅读(1)  评论(0编辑  收藏  举报