From f4220cf8019ae969df94ccde9ab410a19738718d Mon Sep 17 00:00:00 2001 From: Naily Date: Sun, 8 Dec 2024 00:05:13 +0800 Subject: [PATCH] feat(statistic): add slots type (#6599) --- src/statistic/index.ts | 2 +- src/statistic/src/Statistic.tsx | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/statistic/index.ts b/src/statistic/index.ts index 9a603f2bed6..f3816c1fa02 100644 --- a/src/statistic/index.ts +++ b/src/statistic/index.ts @@ -1,2 +1,2 @@ export { default as NStatistic, statisticProps } from './src/Statistic' -export type { StatisticProps } from './src/Statistic' +export type { StatisticProps, StatisticSlots } from './src/Statistic' diff --git a/src/statistic/src/Statistic.tsx b/src/statistic/src/Statistic.tsx index c25c88e8149..ba9f23ac468 100644 --- a/src/statistic/src/Statistic.tsx +++ b/src/statistic/src/Statistic.tsx @@ -1,7 +1,7 @@ import type { ThemeProps } from '../../_mixins' import type { ExtractPublicPropTypes } from '../../_utils' import type { StatisticTheme } from '../styles' -import { computed, defineComponent, h } from 'vue' +import { computed, defineComponent, h, type SlotsType } from 'vue' import { useConfig, useRtl, useTheme, useThemeClass } from '../../_mixins' import { resolveWrappedSlot } from '../../_utils' import { statisticLight } from '../styles' @@ -16,9 +16,17 @@ export const statisticProps = { export type StatisticProps = ExtractPublicPropTypes +export interface StatisticSlots { + default?: any + label?: any + prefix?: any + suffix?: any +} + export default defineComponent({ name: 'Statistic', props: statisticProps, + slots: Object as SlotsType, setup(props) { const { mergedClsPrefixRef, inlineThemeDisabled, mergedRtlRef } = useConfig(props)