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 小时前
React--Fiber 架构
前端·react.js·架构
coderlin_1 小时前
BI布局拖拽 (1) 深入react-gird-layout源码
android·javascript·react.js
伍哥的传说1 小时前
React 实现五子棋人机对战小游戏
前端·javascript·react.js·前端框架·node.js·ecmascript·js
qq_424409191 小时前
uniapp的app项目,某个页面长时间无操作,返回首页
前端·vue.js·uni-app
我在北京coding1 小时前
element el-table渲染二维对象数组
前端·javascript·vue.js
2501_915918411 小时前
Fiddler中文版全面评测:功能亮点、使用场景与中文网资源整合指南
android·ios·小程序·https·uni-app·iphone·webview
布兰妮甜1 小时前
Vue+ElementUI聊天室开发指南
前端·javascript·vue.js·elementui
SevgiliD1 小时前
el-button传入icon用法可能会出现的问题
前端·javascript·vue.js
我在北京coding1 小时前
Element-Plus-全局自动引入图标组件,无需每次import
前端·javascript·vue.js
鱼 空1 小时前
解决el-table右下角被挡住部分
javascript·vue.js·elementui