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>
相关推荐
愚坤1 天前
前端真有意思,JS还能独立做项目?
前端·javascript·github
SGAMERrain1 天前
# Nuxt 4 + MediaPipe:如何在浏览器中实现本地 AI 人脸分析?
前端
github_is_geeksKai1 天前
浏览器端文件处理的边界:PDF 面单、GPX 隐私与 EPUB 修复
前端
李纲明1 天前
微信小程序 getSystemInfo 提示已废弃、屏幕高度算错胶囊还对不齐?getWindowInfo 和 getDeviceInfo 怎么接才稳
javascript·微信小程序·小程序·小程序开发·devdiy
deli0071 天前
从一句反馈到一次升级:Mystudy 的自进化实践
前端
FungLeo1 天前
成为全栈·Vue 管理后台篇·用 fetch 建一层可控的请求内核
前端·javascript·vue.js·http·fetch·formdata·接口封装
用户84298142418101 天前
ByteJS,让重要的 JavaScript 以字节码运行。
javascript
dreams_dream1 天前
微信小程序-使用npm包
微信小程序·小程序·npm
FungLeo1 天前
成为全栈·Vue 管理后台篇·Vue Router如何守住多角色后台边界
前端·javascript·vue.js·rbac·vue router·路由守卫·前端权限
FungLeo1 天前
成为全栈·Vue 管理后台篇·分页只显示第一页:从接口total 定位到前端修复
前端·vue.js·状态模式·分页·naive ui·服务端分页·前端问题排查