diff --git a/src/steps/index.ts b/src/steps/index.ts index ce2cd6f9cd9..62c5eac810c 100644 --- a/src/steps/index.ts +++ b/src/steps/index.ts @@ -1,4 +1,4 @@ export { default as NStep, stepProps } from './src/Step' -export type { StepProps } from './src/Step' +export type { StepProps, StepSlots } from './src/Step' export { default as NSteps, stepsProps } from './src/Steps' -export type { StepsProps } from './src/Steps' +export type { StepsProps, StepsSlots } from './src/Steps' diff --git a/src/steps/src/Step.tsx b/src/steps/src/Step.tsx index 7cd9816172c..b854b649c7a 100644 --- a/src/steps/src/Step.tsx +++ b/src/steps/src/Step.tsx @@ -5,7 +5,8 @@ import { defineComponent, h, inject, - type PropType + type PropType, + type SlotsType } from 'vue' import { NBaseIcon, NIconSwitchTransition } from '../../_internal' import { @@ -36,9 +37,16 @@ export const stepProps = { export type StepProps = ExtractPublicPropTypes +export interface StepSlots { + default?: any + icon?: any + title?: any +} + export default defineComponent({ name: 'Step', props: stepProps, + slots: Object as SlotsType, setup(props) { const NSteps = inject(stepsInjectionKey, null) diff --git a/src/steps/src/Steps.tsx b/src/steps/src/Steps.tsx index 7d3bfddc43e..5a942d3eeff 100644 --- a/src/steps/src/Steps.tsx +++ b/src/steps/src/Steps.tsx @@ -9,6 +9,7 @@ import { provide, type Ref, type Slots, + type SlotsType, type VNode, type VNodeChild } from 'vue' @@ -60,11 +61,18 @@ export interface StepsInjection { export type StepsProps = ExtractPublicPropTypes +export interface StepsSlots { + default?: any + 'finish-icon'?: any + 'error-icon'?: any +} + export const stepsInjectionKey = createInjectionKey('n-steps') export default defineComponent({ name: 'Steps', props: stepsProps, + slots: Object as SlotsType, setup(props, { slots }) { const { mergedClsPrefixRef, mergedRtlRef } = useConfig(props) const rtlEnabledRef = useRtl('Steps', mergedRtlRef, mergedClsPrefixRef)