refactor(components): [tabs] add deprecated mark to activeName (#8590)

This commit is contained in:
qiang 2022-07-02 22:06:40 +08:00 committed by GitHub
parent 5678464c57
commit 59392fa194
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,5 @@
import { import {
computed,
defineComponent, defineComponent,
nextTick, nextTick,
provide, provide,
@ -18,7 +19,7 @@ import { EVENT_CODE, UPDATE_MODEL_EVENT } from '@element-plus/constants'
import ElIcon from '@element-plus/components/icon' import ElIcon from '@element-plus/components/icon'
import { Plus } from '@element-plus/icons-vue' import { Plus } from '@element-plus/icons-vue'
import { tabsRootContextKey } from '@element-plus/tokens' 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 TabNav from './tab-nav'
import type { TabNavInstance } from './tab-nav' import type { TabNavInstance } from './tab-nav'
import type { TabsPaneContext } from '@element-plus/tokens' import type { TabsPaneContext } from '@element-plus/tokens'
@ -135,6 +136,18 @@ export default defineComponent({
emit('tab-add') 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( watch(
() => props.activeName, () => props.activeName,
(modelValue) => setCurrentName(modelValue) (modelValue) => setCurrentName(modelValue)