uni-app切换tabs列表

uni-app实现tabs页面切换
本文介绍了如何在uni-app中实现tabs页面之间的切换,详细讨论了相关vue.js组件的使用和配置,帮助开发者理解在web app开发中的多页面管理。
<template>
	<view class="alarmList">
		<view class="switchHead">
			<view v-for="(item,index) in tabTitleData" class="boxList" :class="{activeCss:activeIndex==index}" :key="index">
				<text @click="clickTab(index)">{{item.name}}</text>
			</view>
		</view>
		<uni-list>
		    <uni-list-item title="标题文字" note="描述信息"></uni-list-item>
		    <uni-list-item title="标题文字" note="描述信息" ></uni-list-item>
		</uni-list>
	</view>
</template>

<script>
	import uniList from "@/components/uni-list/uni-list.vue"
	import uniListItem from "@/components/uni-list-item/uni-list-item.vue"
	export default {
		data() {
			return {
				activeIndex:'0',
				tabTitleData:[
					{
						name:'所有信息'
					},
					{
						name:'已处理'
					},
					{
						name:'未处理'
					}
				]
			}
		},
		components: {uniList,uniListItem},
		methods: {
			clickTab(index){
				this.activeIndex=index;
			}
		}
	}
</script>

<style>
	.alarmList {
		font-size: 14px;
		height: 100%;
	}
	.alarmList .switchHead{
		height: 35px;
		display: flex;
		justify-content: space-around;
		align-items: center;
		color: #FFFFFF;
		background-color: #13D1BE;
	}
	.alarmList .switchHead .boxList{
		height: 100%;
	}
	.alarmList .switchHead .activeCss{
		border-bottom: 2px solid yellow;
		color: yellow;
	}
</style>

结果展示
在这里插入图片描述
在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值