Files
dvcp_v2_wxcp_app/components/AiTabPanes/AiTabPanes.vue
2024-10-31 16:22:41 +08:00

89 lines
1.5 KiB
Vue

<template>
<section class="AiTabPanes" :class="{white}" :style="{background}">
<div class="item" :class="{active:value==i}" v-for="(item, i) in tabs" :key="i"
@click="handleClick(item,i)">{{ getLabel(item) }}
</div>
</section>
</template>
<script>
export default {
name: "AiTabPanes",
data() {
return {}
},
model: {
prop: "value",
event: "change"
},
props: {
value: {default: ""},
tabs: {default: () => []},
background: {default: ""},
white: Boolean
},
methods: {
getLabel(item) {
return item?.label || item
},
handleClick(item, index) {
this.$emit("change", index)
this.$emit("click", item)
}
}
}
</script>
<style lang="scss" scoped>
.AiTabPanes {
width: 100vw;
height: 96px;
line-height: 96px;
background: #3975C6;
display: flex;
.item {
flex: 1;
min-width: 0;
text-align: center;
font-size: 28px;
font-family: PingFangSC-Regular, PingFang SC;
color: #CDDCF0;
&.active {
color: #fff;
font-weight: 500;
position: relative;
&:after {
content: " ";
width: 48px;
height: 4px;
background: #FFF;
position: absolute;
bottom: 14px;
left: 50%;
margin-left: -24px;
}
}
}
&.white {
background: #fff;
.item {
color: #666;
&.active {
color: #000;
font-weight: bold;
&:after {
background: #3399FF;
}
}
}
}
}
</style>