uniapp 实现tabbar分类导航及滚动联动效果

思路:使用两个scroll-view,tabbar分类导航使用scrollleft移动,内容联动使用页面滚动onPageScroll监听滚动高度

效果图
效果图

<template>
	<view class="content" >
		<view :class="[isSticky ? 'tab-sticky': '']">
			<view class="base-combox" >
				<uni-icons type="location-filled" color="#85D8CE" size="25" />
				<text class="tag-text">{
  {base[0].name}}</text>
			</view>
			<view class="u-tab" :class="[!isSticky ? 'tab-sticky': '']">
				<scroll-view scroll-x="true" scroll-with-animation="true" class="u-tab-view menu-scroll-view" :scroll-left="scrollLeft">
					<view v-for="(item,index) in tabbar" :key="index" class="u-tab-item" :class="[isActive == index ? 'u-tab-item-active' : '']"
					 @tap.stop="swichMenu(index)">
						<view class="u-line-1">{
  {item.name}}</view>
					</view>
				</scroll-view>
			</view>
			
		</view>
		
		<scroll-view :scroll-top="scrollTop" scroll-y scroll-with-animation class="right-box" @scroll="upScroll">
			<view class="page-view">
				<view class="class-item" :id="'item' + index" v-for="(item , index) in tabbar" :key="index">
					<view class="item-title">
						<text>{
  {item.name}}</text>
					</view>
					<view class="item-container">
						<view class="thumb-box" v-for="(item1, index1) in item.children" :key="index1" @tap="goList(item1)">
							<image v-if
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值