效果如图:
代码如下:
<template>
<div class="relation-content">
<div class="tabs">
<div
class="tab-item-box"
:class="{
'tab-item-active': currentTab !== index,
'tab-item-noactive': currentTab === index
}"
v-for="(item, index) in tabs"
:key="index"
@click="currentTab = index"
>
<div
class="tab-item"
:class="{
'tab-item-active': currentTab === index,
'tab-item-noactive': currentTab !== index,
'current-left': currentTab - index === 1,
'current-right': index - currentTab === 1
}"
>{{item}}</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: 'relationContent',
data() {
return {
tabs: ['视频解读', '图文解说', '政策依据', '工单案例'],
currentTab: 0
}
}
}
</script>
<style scoped>
.relation-content {
position: relative;
top: 12px;
width: 85%;
min-height: 100px;
margin: 12px 0;
border-radius: 12px;
overflow: auto;
box-shadow: 0px 0px 10px -1px #C2DAFF;
}
.tabs {
width: 100%;
overflow-x: auto;
}
.tabs .tab-item-box {
float: left;
width: 25%;
}
.tabs .tab-item {
float: left;
width: 100%;
height: 36px;
line-height: 36px;
text-align: center;
color: #333;
}
.tabs .tab-item-active {
background-color: #fff;
border-top-left-radius: 12px;
border-top-right-radius: 12px;
}
.tabs .tab-item-noactive {
background-color: #C2DAFF;
}
.tabs .current-left {
border-color: #fff;
border-bottom-right-radius: 18px;
}
.tabs .current-right {
border-bottom-left-radius: 18px;
}
</style>