uniapp切换tab更新下面不同的内容

在这里插入图片描述

<!-- 顶部导航栏 -->
		<view class="nav">
			<view class="flex_center">
					<view class="flex_between">
						<view class="nav_image"><uni-icons type="settings-filled" size="30" color="#F13E37"></uni-icons></view>
						<view class="nav_title" v-for="item in nav">
							<view :class="{'active':isActive==item.isActive}" @click="chenked(item.isActive)">
								{{item.name}}
							</view>
						</view>
						<view class="nav_image"><uni-icons type="search" size="30" color="#F13E37"></uni-icons></view>
					</view>
			</view>
		</view>
		<!-- 顶部导航栏的下面的框 -->
		<view class="nav_item" v-if="isActive==1">
			<view>11</view>
			<social></social>
		</view>
		<view class="nav_item" v-if="isActive==2">
			<view>22</view>
		</view>
		<view class="nav_item" v-if="isActive==3">
			<view>33</view>
		</view>
<script>
	export default {
		data() {
			return {
				nav:[
						{name:'项目',isActive:1},
						{name:'首页',isActive:2},
						{name:'发现',isActive:3}
					],
				isActive: 2,
				}},
		onLoad() {

		},
		methods: {
			//切换nav
			chenked(type) {
				this.isActive = type
			},
		}
	}
</script>
	/* 导航栏 */
	.nav {
				border-top: 1rpx solid #f2f2f2;
				background-color: #fff;
				.flex_center{
				}
				.flex_between {
					display: flex;
					width:750rpx;
					flex-flow: row nowrap;
					justify-content: space-between;
					// background-color: aqua;
					.nav_title {
						display:block;
						height: 88rpx;
						line-height: 88rpx;
						width: 175rpx;
						text-align: center;
						font-size: 32rpx;
						font-family: "PingFang";
						color: rgb(102, 102, 102);
						// background-color: blueviolet;
					}
					.nav_image{
						width:110rpx;
						margin-top:20rpx;
						margin-left:30rpx;
					}
				}
			}
			.active {
					position: relative;
					color: black;
				}
			
				.active::after {
					content: "";
					position: absolute;
					width: 100rpx;
					height: 4rpx;
					background-color: #F13E37;;
					left: 0px;
					right: 0px;
					bottom: 0px;
					margin: auto;}
					.chat-custom-right {
						flex: 1;
						/* #ifndef APP-NVUE */
						display: flex;
						/* #endif */
						flex-direction: column;
						justify-content: space-between;
						align-items: flex-end;
					}
					
					.chat-custom-text {
						font-size: 12px;
						color: #999;
					}
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值