Skip to content

Commit dc9987a

Browse files
committed
fix: steps icon clss error
1 parent 3715ded commit dc9987a

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

components/steps/index.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { booleanType, stringType, functionType, someType } from '../_util/type';
1717

1818
// CSSINJS
1919
import useStyle from './style';
20-
import { useToken } from '../theme/internal';
2120

2221
export const stepsProps = () => ({
2322
prefixCls: String,
@@ -30,11 +29,8 @@ export const stepsProps = () => ({
3029
status: stringType<'wait' | 'process' | 'finish' | 'error'>(),
3130
size: stringType<'default' | 'small'>(),
3231
direction: stringType<'horizontal' | 'vertical'>(),
33-
progressDot: someType<boolean | ProgressDotRender>(
34-
[Boolean, Function],
35-
undefined as boolean | ProgressDotRender,
36-
),
37-
type: stringType<'default' | 'navigation'>(),
32+
progressDot: someType<boolean | ProgressDotRender>([Boolean, Function]),
33+
type: stringType<'default' | 'navigation' | 'inline'>(),
3834
onChange: functionType<(current: number) => void>(),
3935
'onUpdate:current': functionType<(current: number) => void>(),
4036
});
@@ -67,9 +63,6 @@ const Steps = defineComponent({
6763
setup(props, { attrs, slots, emit }) {
6864
const { prefixCls, direction: rtlDirection, configProvider } = useConfigInject('steps', props);
6965

70-
// 接入换肤
71-
const [, token] = useToken();
72-
7366
// style
7467
const [wrapSSR, hashId] = useStyle(prefixCls);
7568

@@ -82,6 +75,8 @@ const Steps = defineComponent({
8275
emit('update:current', current);
8376
emit('change', current);
8477
};
78+
const isInline = computed(() => props.type === 'inline');
79+
const mergedPercent = computed(() => (isInline.value ? undefined : props.percent));
8580
const stepIconRender = ({
8681
node,
8782
status,
@@ -99,9 +94,8 @@ const Steps = defineComponent({
9994
<div class={`${prefixCls.value}-progress-icon`}>
10095
<Progress
10196
type="circle"
102-
percent={props.percent}
97+
percent={mergedPercent.value}
10398
width={progressWidth}
104-
strokeColor={token.value.colorPrimary}
10599
strokeWidth={4}
106100
format={() => null}
107101
/>
@@ -112,22 +106,23 @@ const Steps = defineComponent({
112106
}
113107
return node;
114108
};
109+
const icons = computed(() => ({
110+
finish: <CheckOutlined class={`${prefixCls.value}-finish-icon`} />,
111+
error: <CloseOutlined class={`${prefixCls.value}-error-icon`} />,
112+
}));
115113
return () => {
116114
const stepsClassName = classNames(
117115
{
118116
[`${prefixCls.value}-rtl`]: rtlDirection.value === 'rtl',
119-
[`${prefixCls.value}-with-progress`]: props.percent !== undefined,
117+
[`${prefixCls.value}-with-progress`]: mergedPercent.value !== undefined,
120118
},
121119
attrs.class,
122120
hashId.value,
123121
);
124-
const icons = {
125-
finish: <CheckOutlined class={`${prefixCls}-finish-icon`} />,
126-
error: <CloseOutlined class={`${prefixCls}-error-icon`} />,
127-
};
122+
128123
return wrapSSR(
129124
<VcSteps
130-
icons={icons}
125+
icons={icons.value}
131126
{...attrs}
132127
{...omit(props, ['percent', 'responsive'])}
133128
direction={direction.value}

0 commit comments

Comments
 (0)