Enregistrement d'utilisation du composant scroll-view dans uni-app

scroll-x: axe x scroll
scroll-in-view: id name défile immédiatement jusqu'à la zone d'élément courante

<scroll-view scroll-x="true"  class="scroll-content" :scroll-into-view='scrollIntoIndex'>
			<view 
			:id="'top'+index"
			v-for="(item,index) in topBar" 
			:key="index" 
			class="scroll-item"
			@tap="changeTab(index)"
			>
			<!-- 根据index来判断样式是否选择 -->
				<text :class="topBarIndex===index?'f-active-color':'f-color'">{{item.name}}</text>
			</view>
		</scroll-view>
data() {
			return {
				//选中的索引
				topBarIndex:0,
				//顶栏跟随的索引id值
				scrollIntoIndex:"top0",
				//中间内容块的高度
				mainClientHeight:0,
				//顶栏数据
				topBar:[
					
				],
				//承载数据
				newTopBar:[],
			}
		},
Publié 49 articles originaux · loué 3 · visites 5092

Je suppose que tu aimes

Origine blog.csdn.net/weixin_43487066/article/details/105614275
conseillé
Classement