uniapp解决scroll滑动之后被u-sticky挡住的问题

问题:页面触底加载之后,回到头部,顶部数据被遮挡

<swiper class="swiper-list"></swiper>上的swiper-list样式高度调整成90vh

javascript 复制代码
<view class="main">
	<u-sticky bgColor="#fff">
		<u-tabs ref="uTabs" :list="tabList" lineWidth="26" lineHeight="11" :lineColor="`url(${lineBg}) 100% 100%`"
		:activeStyle="{
	        color: '#303133',
	        fontWeight: 'bold',
	        transform: 'scale(1.05)'
	     }"
	     :inactiveStyle="{
	        color: '#606266',
	        transform: 'scale(1)'
		  }" 
		  itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;margin-bottom: 6px"  @change="tabsChange" @click="tabsChange" :current='swiperCurrent'>
	  </u-tabs>
	</u-sticky>
	<swiper :current="swiperCurrent" @animationfinish="animationfinish" class="swiper-list">
		<swiper-item class="swiper-item" v-for="(item, index) in tabs" :key="index">
			<scroll-view scroll-y style="width: 100%;height: 100%;" @scrolltolower="onreachBottom" refresher-enabled='true'
				<list-box></list-box>
			</scroll-view>
		</swiper-item>
	</swiper>
javascript 复制代码
<script>
	data() {
		return {
			tabList: [{
				name: '全部',
			}, {
				name: '待付款',
			}],
			swiperCurrent: 0, // swiper组件的current值,表示当前那个swiper-item是活动的
		  }
		},
	methods:{
		// tabs通知swiper切换
		tabsChange(obj) {
			this.swiperCurrent = obj.index;
		},
		// 由于swiper的内部机制问题,快速切换swiper不会触发dx的连续变化,需要在结束时重置状态
		// swiper滑动结束,分别设置tabs和swiper的状态
		animationfinish(e) {
			this.swiperCurrent =  e.detail.current;
		}
	}
</script>
javascript 复制代码
<style lang="scss" scoped>
	.swiper-list {
		background-color: #f5f5f5;
		// height: 100vh; 这里的100vh要改成90,不然会出现两个滚动条
		height: 90vh;
		width: 100%;
	}
</style>
相关推荐
SouthernWind1 分钟前
RAGFlow——结合本地知识库检索开发实战指南(包含聊天、检索本地的知识库文档和Agent模式)
前端
三翼鸟数字化技术团队20 分钟前
websocket及SSE原理解析
前端
妙码生花1 小时前
从 PHP 到 AI + Golang,程序员自救转型手记(八):设计管理员模型、热重载配置
前端·后端·go
政采云技术1 小时前
Chrome 高阶调试技巧
前端
牧艺1 小时前
HTML-in-Canvas 深度解析:让 Canvas 真正「吃上」HTML 这碗饭
前端·html·canvas
唯火锅不可辜负1 小时前
避坑指南:iOS 下 scroll-view 嵌套 fixed 布局的“翻车”现场与修复
微信小程序
秦瑜华1 小时前
前端页面添加AI自动翻译按钮
前端·openai·ai编程
沉浸学习的匿名网友1 小时前
什么是 .gitignore?为什么每个 Git 项目几乎都离不开它?
前端·git
Apifox1 小时前
从 Postman 迁移到 Apifox:Workspace、Collection、Environment 现在可以一起导入了
前端·后端·程序员
didiplus2 小时前
运维人的随身神器:我把25个常用工具塞进了微信小程序
微信小程序