diff --git a/packages/components/tabs/src/tabs.tsx b/packages/components/tabs/src/tabs.tsx index f19db45243..6545f84bfe 100644 --- a/packages/components/tabs/src/tabs.tsx +++ b/packages/components/tabs/src/tabs.tsx @@ -1,4 +1,5 @@ import { + computed, defineComponent, nextTick, provide, @@ -18,7 +19,7 @@ import { EVENT_CODE, UPDATE_MODEL_EVENT } from '@element-plus/constants' import ElIcon from '@element-plus/components/icon' import { Plus } from '@element-plus/icons-vue' import { tabsRootContextKey } from '@element-plus/tokens' -import { useNamespace } from '@element-plus/hooks' +import { useDeprecated, useNamespace } from '@element-plus/hooks' import TabNav from './tab-nav' import type { TabNavInstance } from './tab-nav' import type { TabsPaneContext } from '@element-plus/tokens' @@ -135,6 +136,18 @@ export default defineComponent({ emit('tab-add') } + useDeprecated( + { + from: '"activeName"', + replacement: '"model-value" or "v-model"', + scope: 'ElTabs', + version: '2.3.0', + ref: 'https://element-plus.org/en-US/component/tabs.html#attributes', + type: 'Attribute', + }, + computed(() => !!props.activeName) + ) + watch( () => props.activeName, (modelValue) => setCurrentName(modelValue)