不规则tab切换

 

<template>
	
		<div class="nav_wrapper">
			<div @tap="changeNav(index)" v-for="(item,index) in navList" :key="index" class="nav_item"
				:class="{'active':index==currentNav}">
				<span v-text="item"></span>
				<img v-if="index==currentNav" class="nav_icon nav_icon_r" src="../static/page_tab01@2x.png">
				<img v-if="index>currentNav" class="nav_icon nav_icon_r nav_icon_base"
					src="../static/page_tab03@2x.png">
				<img v-if="index==currentNav" class="nav_icon nav_icon_l" src="../static/page_tab02@2x.png">
				<img v-if="index<currentNav" class="nav_icon nav_icon_l nav_icon_base"
					src="../static/page_tab04@2x.png">
			</div>
		</div>

	
</template>

<script>
	export default {
		data() {
			return {
				// 当前菜单栏
					currentNav: 0,
					// 菜单栏
					navList: ['未使用', '已使用', '过期'],
			}
		},
		methods: {
			// 切换菜单栏
				changeNav(index) {
					if (this.currentNav != index) {
						this.currentNav = index
					}
				},
		}
	}
</script>

<style>
.nav_wrapper {
  top: 0.88rem;
  height: 0.96rem;
  width: 100%;
  display: flex;
  align-items: flex-end;
  position: fixed;
  left: 0;
  z-index: 99;
}
.nav_wrapper .nav_item {
  font-size: 0.24rem;
  height: 0.96rem;
  flex: 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #c0e3f5;
  font-family: Source Han Sans SC;
  font-weight: 300;
  color: #295880;
  border-radius: 0.08rem 0.08rem 0 0;
  position: relative;
}
.nav_wrapper .nav_item.active {
  font-size: 0.26rem;
  height: 1.04rem;
  background-color: #fff;
  font-family: Source Han Sans SC;
  font-weight: bold;
  color: #3A7EB7;
}
.nav_wrapper .nav_item .nav_icon {
  width: 1.04rem;
  height: 1.04rem;
  position: absolute;
  top: 0;
  z-index: 10;
}
.nav_wrapper .nav_item .nav_icon_base {
  width: 1.44rem;
  height: 0.96rem;
  z-index: 9;
}
.nav_wrapper .nav_item .nav_icon_l {
  left: -0.92rem;
}
.nav_wrapper .nav_item .nav_icon_l.nav_icon_base {
  left: -1.08rem;
}
.nav_wrapper .nav_item .nav_icon_r {
  right: -0.92rem;
}
.nav_wrapper .nav_item .nav_icon_r.nav_icon_base {
  right: -1.08rem;
}

</style>

 

page_tab01@2x 

page_tab02@2x

page_tab03@2x

page_tab04@2x

 

 

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值