上海市东方医院导视
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

57 lines
1.2 KiB

<template>
<div class="tabs-wrapper">
<div class="tab" :class="{ active: tabIdx === index }" @click="handleTab(index)" v-for="(item, index) of list" :key="item.name">
<img :src="tabIdx === index ? item.iconActive : item.icon" alt="" />
{{ item.name }}
</div>
</div>
</template>
<script setup>
import { ref } from 'vue'
defineProps({
list: {
type: Array,
default: () => []
}
})
const emits = defineEmits(['click'])
const tabIdx = ref(0)
function handleTab(index) {
tabIdx.value = index
emits('click', index)
}
</script>
<style lang="scss" scoped>
.tabs-wrapper {
display: flex;
width: 100%;
height: 64px;
background: var(--search-tabsBg, rgba(0, 0, 0, 0.05));
border-radius: var(--global-radius, 12px);
overflow: hidden;
.tab {
height: 100%;
flex: 1;
display: flex;
align-items: center;
justify-content: center;
color: var(--search-tabColor, rgba(0, 0, 0, 0.6));
border-radius: var(--global-radius, 12px);
&.active {
background: var(--search-tabActiveBg, #ffffff);
color: var(--search-tabActiveColor, rgba(0, 0, 0, 0.8));
}
}
img {
width: 24px;
height: 24px;
margin-right: 12px;
}
}
</style>