vue分割开的tab组件效果

一,实现效果

在这里插入图片描述
本来可以直接使用element-ui组件来实现的,但是这里 中间断开了,所以只能自己写了:

二,实现思路

在这里插入图片描述

三,具体代码

<template>
	<div>
		<!-- 头部区域 -->
		<page-head ></page-head>
		<!-- tab栏目区域 -->
		<ul class="tabBox">
			<li 
				class="tabItem" 
				v-for="(item,index) in tabList" 
				:key="index" 
				:class="index === currentActive ? 'active' : ''" 
				@click.self="changeTab(index)"
				>
				{{item}}
			</li>
		</ul>
		<!-- 具体信息设置区域 -->
		<el-card shadow="never">
			<!-- 商家信息设置组件 -->
			<template class="businessInfo" v-if="currentActive===0">
				<business-info></business-info>
			</template>
			<!-- 外卖管理组件 -->
			<template class="takeawayManage" v-if="currentActive===1">
				外卖管理
			</template>
			<!-- 预约管理组件 -->
			<template class="bookManage" v-if="currentActive===2">
				预约管理
			</template>
			<!-- 点餐白名单组件 -->
			<template class="order_white_list" v-if="currentActive===3">
				点餐白名单
			</template>
			<!-- 第三方配送组件 -->
			<template class="thirdParty" v-if="currentActive===4">
				第三方配送
			</template>
			<!-- 账号安全组件 -->
			<template class="accountSecurity" v-if="currentActive===5">
				账号安全
			</template>
			<!-- 公众号设置组件 -->
			<template class="accountSetting" v-if="currentActive===6">
				公众号设置
			</template>
			
		</el-card>
	</div>
</template>

<script>
	import pageHead from '../../components/pageHead'
	import businessInfo from './setting/BusinessInfo'
	export default{
		data(){
			return{
				tabList:['商家信息','外卖管理','预约管理','点餐白名单','第三方配送','账号安全','公众号设置'],
				currentActive:0
			}
		},
		components:{
			pageHead,
			businessInfo
		},
		methods:{
			//点击tab栏目实现样式变化
			changeTab(index){
				this.currentActive=index
			}
		}
	}
</script>

<style lang="less" scoped>
	.tabBox{
		display: flex;
		align-items: center;
		height: 80px;
		margin: 15px;
		background-color: #ffffff;
		justify-content: start;
		.tabItem{
			width: 100px;
			height: 40px;
			color: #000000;
			font-size: 14px;
			line-height: 40px;
			text-align: center;
			border: 1px solid #ccc;
			border-left: none;
			cursor: pointer;
			&:first-child{
				border-left: 1px solid #ccc;
				border-top-left-radius: 5px;
				border-bottom-left-radius: 5px;
				margin-left: 20px;
			}
			&:last-child{
				border-top-right-radius: 5px;
				border-bottom-right-radius: 5px;
			}
		}
		.active{
			background-color: #D89968;
			color: #ffffff;
		}
	}
	.el-card{
		margin: 0 15px 15px;
	}	
</style>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值