Skip to content

Commit

Permalink
feat(tabs): add slots type (tusen-ai#6599)
Browse files Browse the repository at this point in the history
  • Loading branch information
nailiable committed Dec 7, 2024
1 parent 7dd15f0 commit a27a085
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ export type { TabsInst } from './src/interface'
export { default as NTab, tabProps } from './src/Tab'
export type { TabProps } from './src/Tab'
export { default as NTabPane, tabPaneProps } from './src/TabPane'
export type { TabPaneProps } from './src/TabPane'
export type { TabPaneProps, TabPaneSlots } from './src/TabPane'
export { default as NTabs, tabsProps } from './src/Tabs'
export type { TabsProps } from './src/Tabs'
export type { TabsProps, TabsSlots } from './src/Tabs'
8 changes: 8 additions & 0 deletions src/tabs/src/TabPane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
type HTMLAttributes,
inject,
type PropType,
type SlotsType,
type VNode,
type VNodeChild,
watchEffect
Expand Down Expand Up @@ -38,11 +39,18 @@ export const tabPaneProps = {

export type TabPaneProps = ExtractPublicPropTypes<typeof tabPaneProps>

export interface TabPaneSlots {
default?: any
prefix?: any
suffix?: any
}

export default defineComponent({
__TAB_PANE__: true,
name: 'TabPane',
alias: ['TabPanel'],
props: tabPaneProps,
slots: Object as SlotsType<TabPaneSlots>,
setup(props) {
if (__DEV__) {
watchEffect(() => {
Expand Down
8 changes: 8 additions & 0 deletions src/tabs/src/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
type PropType,
provide,
ref,
type SlotsType,
toRef,
TransitionGroup,
type VNode,
Expand Down Expand Up @@ -114,9 +115,16 @@ export const tabsProps = {

export type TabsProps = ExtractPublicPropTypes<typeof tabsProps>

export interface TabsSlots {
default?: any
prefix?: any
suffix?: any
}

export default defineComponent({
name: 'Tabs',
props: tabsProps,
slots: Object as SlotsType<TabsSlots>,
setup(props, { slots }) {
if (__DEV__) {
watchEffect(() => {
Expand Down

0 comments on commit a27a085

Please sign in to comment.