fix: steps icon clss error

pull/6265/head^2
tangjinzhou 2 years ago
parent 3715ded674
commit dc9987aea8

@ -17,7 +17,6 @@ import { booleanType, stringType, functionType, someType } from '../_util/type';
// CSSINJS // CSSINJS
import useStyle from './style'; import useStyle from './style';
import { useToken } from '../theme/internal';
export const stepsProps = () => ({ export const stepsProps = () => ({
prefixCls: String, prefixCls: String,
@ -30,11 +29,8 @@ export const stepsProps = () => ({
status: stringType<'wait' | 'process' | 'finish' | 'error'>(), status: stringType<'wait' | 'process' | 'finish' | 'error'>(),
size: stringType<'default' | 'small'>(), size: stringType<'default' | 'small'>(),
direction: stringType<'horizontal' | 'vertical'>(), direction: stringType<'horizontal' | 'vertical'>(),
progressDot: someType<boolean | ProgressDotRender>( progressDot: someType<boolean | ProgressDotRender>([Boolean, Function]),
[Boolean, Function], type: stringType<'default' | 'navigation' | 'inline'>(),
undefined as boolean | ProgressDotRender,
),
type: stringType<'default' | 'navigation'>(),
onChange: functionType<(current: number) => void>(), onChange: functionType<(current: number) => void>(),
'onUpdate:current': functionType<(current: number) => void>(), 'onUpdate:current': functionType<(current: number) => void>(),
}); });
@ -67,9 +63,6 @@ const Steps = defineComponent({
setup(props, { attrs, slots, emit }) { setup(props, { attrs, slots, emit }) {
const { prefixCls, direction: rtlDirection, configProvider } = useConfigInject('steps', props); const { prefixCls, direction: rtlDirection, configProvider } = useConfigInject('steps', props);
//
const [, token] = useToken();
// style // style
const [wrapSSR, hashId] = useStyle(prefixCls); const [wrapSSR, hashId] = useStyle(prefixCls);
@ -82,6 +75,8 @@ const Steps = defineComponent({
emit('update:current', current); emit('update:current', current);
emit('change', current); emit('change', current);
}; };
const isInline = computed(() => props.type === 'inline');
const mergedPercent = computed(() => (isInline.value ? undefined : props.percent));
const stepIconRender = ({ const stepIconRender = ({
node, node,
status, status,
@ -99,9 +94,8 @@ const Steps = defineComponent({
<div class={`${prefixCls.value}-progress-icon`}> <div class={`${prefixCls.value}-progress-icon`}>
<Progress <Progress
type="circle" type="circle"
percent={props.percent} percent={mergedPercent.value}
width={progressWidth} width={progressWidth}
strokeColor={token.value.colorPrimary}
strokeWidth={4} strokeWidth={4}
format={() => null} format={() => null}
/> />
@ -112,22 +106,23 @@ const Steps = defineComponent({
} }
return node; return node;
}; };
const icons = computed(() => ({
finish: <CheckOutlined class={`${prefixCls.value}-finish-icon`} />,
error: <CloseOutlined class={`${prefixCls.value}-error-icon`} />,
}));
return () => { return () => {
const stepsClassName = classNames( const stepsClassName = classNames(
{ {
[`${prefixCls.value}-rtl`]: rtlDirection.value === 'rtl', [`${prefixCls.value}-rtl`]: rtlDirection.value === 'rtl',
[`${prefixCls.value}-with-progress`]: props.percent !== undefined, [`${prefixCls.value}-with-progress`]: mergedPercent.value !== undefined,
}, },
attrs.class, attrs.class,
hashId.value, hashId.value,
); );
const icons = {
finish: <CheckOutlined class={`${prefixCls}-finish-icon`} />,
error: <CloseOutlined class={`${prefixCls}-error-icon`} />,
};
return wrapSSR( return wrapSSR(
<VcSteps <VcSteps
icons={icons} icons={icons.value}
{...attrs} {...attrs}
{...omit(props, ['percent', 'responsive'])} {...omit(props, ['percent', 'responsive'])}
direction={direction.value} direction={direction.value}

Loading…
Cancel
Save