From b9db3220371873e4407eb7773c142b271ba8992a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B3=A2=E6=AF=94=E5=B0=8F=E9=87=91=E5=88=9A?= <2890636389@qq.com> Date: Fri, 21 May 2021 14:42:49 +0800 Subject: [PATCH] fix: add tabs type's defination (#2020) * fix: add tabs type's defination * feat: add tab's type, tab-position defination * Update tabs.vue * Update tabs.vue * Update tab-nav.vue --- packages/tabs/src/tab-nav.vue | 4 ++-- packages/tabs/src/tabs.vue | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/tabs/src/tab-nav.vue b/packages/tabs/src/tab-nav.vue index 5f7a5df125..3b2cc60712 100644 --- a/packages/tabs/src/tab-nav.vue +++ b/packages/tabs/src/tab-nav.vue @@ -5,7 +5,7 @@ import { EVENT_CODE } from '@element-plus/utils/aria' import { on, off } from '@element-plus/utils/dom' import TabBar from './tab-bar.vue' import { NOOP, capitalize } from '@vue/shared' -import { RootTabs, Pane } from './tabs.vue' +import { RootTabs, Pane, ITabType } from './tabs.vue' type RefElement = Nullable @@ -38,7 +38,7 @@ export default defineComponent({ default: NOOP, }, type: { - type: String, + type: String as PropType, default: '', }, stretch: Boolean, diff --git a/packages/tabs/src/tabs.vue b/packages/tabs/src/tabs.vue index 75733ef480..09e292323d 100644 --- a/packages/tabs/src/tabs.vue +++ b/packages/tabs/src/tabs.vue @@ -5,14 +5,17 @@ import TabNav from './tab-nav.vue' type BeforeLeave = (newTabName: string, oldTabName: string) => void | Promise | boolean +export type ITabType = 'card' | 'border-card' | '' +type ITabPosition = 'top' | 'right' | 'bottom' | 'left' + export interface IETabsProps { - type: string + type: ITabType activeName: string closable: boolean addable: boolean modelValue: string editable: boolean - tabPosition: string + tabPosition: ITabPosition beforeLeave: BeforeLeave stretch: boolean } @@ -47,7 +50,7 @@ export default defineComponent({ components: { TabNav }, props: { type: { - type: String, + type: String as PropType, default: '', }, activeName: { @@ -62,7 +65,7 @@ export default defineComponent({ }, editable: Boolean, tabPosition: { - type: String, + type: String as PropType, default: 'top', }, beforeLeave: {