From b95cf940af8e01e4eca30b2599b029c2f645bd1e Mon Sep 17 00:00:00 2001 From: charles <981744753@qq.com> Date: 星期一, 29 四月 2024 10:44:26 +0800 Subject: [PATCH] feat:创建新分支 --- src/views/dashboard/components/TaskTabs.vue | 37 ++++++++++++++++++++++++------------- 1 files changed, 24 insertions(+), 13 deletions(-) diff --git a/src/views/dashboard/components/TaskTabs.vue b/src/views/dashboard/components/TaskTabs.vue index 4c848ab..e942cf3 100644 --- a/src/views/dashboard/components/TaskTabs.vue +++ b/src/views/dashboard/components/TaskTabs.vue @@ -1,41 +1,52 @@ <template> <div class="task-tabs"> <div - v-for="tabName in list" - :key="tabName" + v-for="tab in list" + :key="tab.value" class="task-tab-item triangle-tip" - :class="{ active: props.modelValue === tabName }" - @click="selectTab(tabName)" + :class="{ active: props.modelValue === tab.value }" + @click="selectTab(tab)" > - {{ tabName }} + {{ tab.label }} </div> </div> </template> <script setup lang="ts"> import { useVModel } from '@vueuse/core' +export interface LabelValue { + label: string + value: any +} + const props = defineProps<{ - list: string[] - modelValue?: string + /** tab 鍒楄〃*/ + list: LabelValue[] + /** 褰撳墠閫変腑鐨� tab*/ + modelValue?: any }>() -const emit = defineEmits(['update:modelValue']) +const emit = defineEmits<{ + 'update:modelValue': [tabName: string] + change: [tab: LabelValue] +}>() const data = useVModel(props, 'modelValue', emit) -function selectTab(tabName: string) { - data.value = tabName +function selectTab(tab: LabelValue) { + data.value = tab.value + emit('change', tab) } </script> <style scoped lang="scss"> $active-bg: #6b83ff; $tab-bg: #0b4694; -$tab-height: 50px; +$tab-height: 46px; .task-tabs { background-color: transparent; display: flex; align-items: center; justify-content: space-between; height: $tab-height; - font-size: 20px; + font-size: 18px; .task-tab-item { background-color: $tab-bg; @@ -66,7 +77,7 @@ position: absolute; left: 50%; margin-left: -10px; - bottom: -10px; + bottom: -8px; display: none; } .active.triangle-tip:before { -- Gitblit v1.8.0