From edccdaf335769ab0187edadb8e612fe2a7534836 Mon Sep 17 00:00:00 2001 From: Tyh2001 <1469442737@qq.com> Date: Thu, 27 Jul 2023 20:39:48 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E4=BC=98=E5=8C=96=20tabs=20=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fighting-design/tabs-item/src/tabs-item.vue | 5 ++--- packages/fighting-design/tabs/src/tabs.vue | 12 +++++++++++- start/src/App.vue | 15 ++++++++++----- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/packages/fighting-design/tabs-item/src/tabs-item.vue b/packages/fighting-design/tabs-item/src/tabs-item.vue index 478b2169d8..eeeb733c23 100644 --- a/packages/fighting-design/tabs-item/src/tabs-item.vue +++ b/packages/fighting-design/tabs-item/src/tabs-item.vue @@ -7,8 +7,7 @@ getCurrentInstance, ref, onMounted, - reactive, - toRef + reactive } from 'vue' import type { ComponentInternalInstance } from 'vue' @@ -28,7 +27,7 @@ const options = reactive({ activeName, uid: instance.uid, - label: toRef(prop, 'label') + label: prop.label }) /** 该组件是否显示 */ diff --git a/packages/fighting-design/tabs/src/tabs.vue b/packages/fighting-design/tabs/src/tabs.vue index f260f8b56c..e504db7b9e 100644 --- a/packages/fighting-design/tabs/src/tabs.vue +++ b/packages/fighting-design/tabs/src/tabs.vue @@ -84,6 +84,17 @@ label: item.label } as const }) + + if (modelValue.value) { + activeName.value = modelValue.value + return + } + + if (children.value && children.value.length) { + if (children.value[0].name) { + activeName.value = children.value[0].name + } + } } /** 将信息传递给子组件 */ @@ -104,7 +115,6 @@