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
This commit is contained in:
波比小金刚 2021-05-21 14:42:49 +08:00 committed by GitHub
parent 60fd5a3b5f
commit b9db322037
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -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<HTMLElement>
@ -38,7 +38,7 @@ export default defineComponent({
default: NOOP,
},
type: {
type: String,
type: String as PropType<ITabType>,
default: '',
},
stretch: Boolean,

View File

@ -5,14 +5,17 @@ import TabNav from './tab-nav.vue'
type BeforeLeave = (newTabName: string, oldTabName: string) => void | Promise<void> | 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<ITabType>,
default: '',
},
activeName: {
@ -62,7 +65,7 @@ export default defineComponent({
},
editable: Boolean,
tabPosition: {
type: String,
type: String as PropType<ITabPosition>,
default: 'top',
},
beforeLeave: {