89 lines
1.6 KiB
Vue
89 lines
1.6 KiB
Vue
<template>
|
|
<div>
|
|
<div class="tabs-container ">
|
|
<div
|
|
class="tab-item"
|
|
:class="{ active: activeTab === 'reference' }"
|
|
@click="switchTab('reference')"
|
|
>
|
|
参考生图
|
|
</div>
|
|
<div
|
|
class="tab-item"
|
|
:class="{ active: activeTab === 'text' }"
|
|
@click="switchTab('text')"
|
|
>
|
|
文生图
|
|
</div>
|
|
<div
|
|
class="tab-item"
|
|
:class="{ active: activeTab === 'image' }"
|
|
@click="switchTab('image')"
|
|
>
|
|
图生图
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script setup lang='ts'>
|
|
|
|
// 接收父组件传递的activeTab
|
|
defineProps<{
|
|
activeTab: string;
|
|
}>();
|
|
|
|
// 定义事件
|
|
const emit = defineEmits<{
|
|
(e: 'tabChange', tab: string): void;
|
|
}>();
|
|
|
|
// 切换tab
|
|
const switchTab = (tab: string) => {
|
|
emit('tabChange', tab);
|
|
};
|
|
</script>
|
|
<style scoped lang='less'>
|
|
.tabs-container {
|
|
width: 100%;
|
|
height: 44x;
|
|
display: flex;
|
|
background-color: #1a1c20;
|
|
border-radius: 12px;
|
|
overflow: hidden;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
.tab-item {
|
|
flex: 1;
|
|
padding: 12px 0;
|
|
background: transparent;
|
|
border: none;
|
|
color: rgba(255, 255, 255, 0.6);
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.3s;
|
|
text-align: center;
|
|
position: relative;
|
|
}
|
|
|
|
.tab-item:hover {
|
|
color: #fff;
|
|
background-color: rgba(255, 255, 255, 0.08);
|
|
}
|
|
|
|
.tab-item.active {
|
|
color: #fff;
|
|
background-color: rgba(255, 255, 255, 0.15);
|
|
}
|
|
|
|
.tab-item.active::after {
|
|
content: '';
|
|
position: absolute;
|
|
bottom: 0;
|
|
left: 20%;
|
|
width: 60%;
|
|
height: 2px;
|
|
border-radius: 2px;
|
|
}
|
|
</style> |