diff --git a/packages/ui/src/components/steps/Step.vue b/packages/ui/src/components/steps/Step.vue index 0c081bb3a..e25afbf7d 100644 --- a/packages/ui/src/components/steps/Step.vue +++ b/packages/ui/src/components/steps/Step.vue @@ -12,8 +12,9 @@ defineSlots() const $slots = useSlots() const context = inject(stepsContextKey, null) -// Register this step and get its index +// Register this step and get its index (side-effect: increments parent counter) const stepIndex = context?.registerStep() ?? 0 +const initial = computed(() => context?.initial.value ?? 0) const currentStatus = computed(() => { if (props.status) return props.status @@ -44,25 +45,28 @@ function handleKeydown(event: KeyboardEvent) { const hasTitle = computed(() => !!props.title || !!$slots.title) const hasDescription = computed(() => !!props.description || !!$slots.description) const hasSubTitle = computed(() => !!props.subTitle || !!$slots.subTitle) -const hasCustomIcon = computed(() => !!$slots.icon) +const hasCustomIcon = computed(() => !!props.icon || !!$slots.icon) +const isProgressDot = computed(() => !!context?.progressDot.value) const isFinish = computed(() => currentStatus.value === 'finish') const isError = computed(() => currentStatus.value === 'error') -const stepNumber = computed(() => String(stepIndex + 1)) +const stepNumber = computed(() => String(stepIndex + initial.value + 1)) const classes = computed(() => ({ 'ant-steps-item': true, [`ant-steps-item-${currentStatus.value}`]: true, 'ant-steps-item-disabled': props.disabled, 'ant-steps-item-clickable': isClickable.value && !props.disabled, - 'ant-steps-item-custom': hasCustomIcon.value, + 'ant-steps-item-custom': hasCustomIcon.value && !isProgressDot.value, })) + +const stepRole = computed(() => (isClickable.value ? 'button' : undefined))