uniapp 模块设置overflow:auto/scroll-view滑动与下拉刷新onPullDownRefresh冲突

解决方式一:

在下拉模块添加@touchmove.stop @touch.stop

此方式为网上搜索结果,没有成功,可能是由于我的overflow是一个组件中的内容,onPullDownRefresh在父组件中触发,没有具体试过

方式二:在模块滑动时@scroll="pullDownClose" 触发的方法pullDownClose中,禁止下拉刷新,同时添加 @touchstart.stop 阻止页面的@touchstart="pullDownOpen"事件

      pullDownClose(){
				const pages = getCurrentPages();
				const page = pages[pages.length - 1];  
				const currentWebview = page.$getAppWebview();
				//根据状态值来切换禁用/开启下拉刷新
				currentWebview.setStyle({  
				  pullToRefresh: {  
					support: false,    //通过切换此处 开启/禁用
					// style: plus.os.name === 'Android' ? 'circle' : 'default',
					style:'circle'  
				  }  
				});
			},

 在滑动页面其他地方再开启下拉刷新 @touchstart="pullDownOpen"

posted @ 2025-06-06 10:33  埃菲尔上的加菲猫  阅读(388)  评论(0)    收藏  举报