微信小程序:scroll-view组件滑动多次触发scroll事件的bug解决

时间:2025-04-02 18:13:31
setContainerHeight(){ const systemInfo = wx.getSystemInfoSync(); this.data.containerHeight = systemInfo.windowHeight - 50; }, getList() { /*这里是data中的原始分页信息数据*/ const data = this.data; const that = this; const pageInfo = data.pageInfo; /*下面是对设置的开关的处理*/ if (data.doneLoading) { return; } data.doneLoading = true; /*发异步请求(根据具体项目中对http请求的封装)*/ if(data.pageInfo.totalCount>data.cancelList.length){ CancelInfo.getCanceltList({ currentPage: data.pageInfo.currentPage }).then(res => { if (res.retCode === 200) { data.pageInfo.currentPage = res.data.paginationInfo.currentPage + 1; data.pageInfo.totalCount = res.data.paginationInfo.totalRecord; data.cancelList = data.cancelList.concat(res.data.dataInfo); } /*请求成功重设开关*/ data.doneLoading = false; }).catch(err => { console.log(err); }) } },