diff --git a/src/components/base/tabs/TabItem.vue b/src/components/base/tabs/TabItem.vue index 4be8a44f1..8041c2482 100644 --- a/src/components/base/tabs/TabItem.vue +++ b/src/components/base/tabs/TabItem.vue @@ -1,5 +1,25 @@ - + diff --git a/src/components/base/tabs/Tabbar.story.vue b/src/components/base/tabs/Tabbar.story.vue index b033864f2..e6faa8ab7 100644 --- a/src/components/base/tabs/Tabbar.story.vue +++ b/src/components/base/tabs/Tabbar.story.vue @@ -3,11 +3,11 @@ import { VTabbar } from "./index"; function initState() { return { - active: "johnniang", + activeId: "johnniang", items: [ - { label: "Ryan Wang", value: "ryanwang" }, - { label: "JohnNiang", value: "johnniang" }, - { label: "guqing", value: "guqing" }, + { label: "Ryan Wang", id: "ryanwang" }, + { label: "JohnNiang", id: "johnniang" }, + { label: "guqing", id: "guqing" }, ], }; } @@ -16,20 +16,20 @@ function initState() { diff --git a/src/components/base/tabs/Tabbar.vue b/src/components/base/tabs/Tabbar.vue index d45b0754b..0d28352cc 100644 --- a/src/components/base/tabs/Tabbar.vue +++ b/src/components/base/tabs/Tabbar.vue @@ -4,7 +4,7 @@ import { computed } from "vue"; import type { Type } from "./interface"; const props = defineProps({ - active: { + activeId: { type: [Number, String], }, items: { @@ -14,9 +14,9 @@ const props = defineProps({ type: String as PropType, default: "default", }, - valueKey: { + idKey: { type: String, - default: "value", + default: "id", }, labelKey: { type: String, @@ -24,15 +24,15 @@ const props = defineProps({ }, }); -const emit = defineEmits(["update:active", "change"]); +const emit = defineEmits(["update:activeId", "change"]); const classes = computed(() => { return [`tabbar-${props.type}`]; }); -const handleChange = (value: number | string) => { - emit("update:active", value); - emit("change", value); +const handleChange = (id: number | string) => { + emit("update:activeId", id); + emit("change", id); };