From 30ffd0a22b62936d826655f0a454c85ffb9e7068 Mon Sep 17 00:00:00 2001 From: Naily Date: Sun, 8 Dec 2024 00:14:37 +0800 Subject: [PATCH] feat(thing): add slots type (#6599) --- src/thing/index.ts | 2 +- src/thing/src/Thing.tsx | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/thing/index.ts b/src/thing/index.ts index f99ef2d69a0..776f864b5d6 100644 --- a/src/thing/index.ts +++ b/src/thing/index.ts @@ -1,2 +1,2 @@ export { default as NThing, thingProps } from './src/Thing' -export type { ThingProps } from './src/Thing' +export type { ThingProps, ThingSlots } from './src/Thing' diff --git a/src/thing/src/Thing.tsx b/src/thing/src/Thing.tsx index a8e81508505..56b076ebee4 100644 --- a/src/thing/src/Thing.tsx +++ b/src/thing/src/Thing.tsx @@ -7,7 +7,8 @@ import { defineComponent, Fragment, h, - type PropType + type PropType, + type SlotsType } from 'vue' import { useConfig, useRtl, useTheme, useThemeClass } from '../../_mixins' import { thingLight } from '../styles' @@ -28,9 +29,20 @@ export const thingProps = { export type ThingProps = ExtractPublicPropTypes +export interface ThingSlots { + action?: any + avatar?: any + default?: any + description?: any + footer?: any + 'header-extra'?: any + header?: any +} + export default defineComponent({ name: 'Thing', props: thingProps, + slots: Object as SlotsType, setup(props, { slots }) { const { mergedClsPrefixRef, inlineThemeDisabled, mergedRtlRef } = useConfig(props)