fix: step type error #4908

close #4908
pull/4940/head
tangjinzhou 2021-11-26 21:48:35 +08:00
parent 5ad66497e5
commit bbfe451d5e
2 changed files with 28 additions and 26 deletions

View File

@ -11,6 +11,7 @@ import useBreakpoint from '../_util/hooks/useBreakpoint';
import classNames from '../_util/classNames';
import Progress from '../progress';
import omit from '../_util/omit';
import { VcStepProps } from '../vc-steps/Step';
export const stepsProps = () => ({
prefixCls: PropTypes.string,
@ -121,7 +122,7 @@ const Steps = defineComponent({
});
/* istanbul ignore next */
export const Step = defineComponent({ ...VcStep, name: 'AStep' });
export const Step = defineComponent({ ...VcStep, name: 'AStep', props: VcStepProps() });
export default Object.assign(Steps, {
Step,
install: (app: App) => {

View File

@ -7,33 +7,34 @@ function isString(str: any): str is string {
return typeof str === 'string';
}
function noop() {}
export const VcStepProps = () => ({
prefixCls: PropTypes.string,
wrapperStyle: PropTypes.style,
itemWidth: PropTypes.string,
active: PropTypes.looseBool,
disabled: PropTypes.looseBool,
status: PropTypes.string,
iconPrefix: PropTypes.string,
icon: PropTypes.any,
adjustMarginRight: PropTypes.string,
stepNumber: PropTypes.number,
stepIndex: PropTypes.number,
description: PropTypes.any,
title: PropTypes.any,
subTitle: PropTypes.any,
progressDot: withUndefined(PropTypes.oneOfType([PropTypes.looseBool, PropTypes.func])),
tailContent: PropTypes.any,
icons: PropTypes.shape({
finish: PropTypes.any,
error: PropTypes.any,
}).loose,
onClick: PropTypes.func,
onStepClick: PropTypes.func,
stepIcon: PropTypes.func,
});
export default defineComponent({
name: 'Step',
props: {
prefixCls: PropTypes.string,
wrapperStyle: PropTypes.style,
itemWidth: PropTypes.string,
active: PropTypes.looseBool,
disabled: PropTypes.looseBool,
status: PropTypes.string,
iconPrefix: PropTypes.string,
icon: PropTypes.any,
adjustMarginRight: PropTypes.string,
stepNumber: PropTypes.number,
stepIndex: PropTypes.number,
description: PropTypes.any,
title: PropTypes.any,
subTitle: PropTypes.any,
progressDot: withUndefined(PropTypes.oneOfType([PropTypes.looseBool, PropTypes.func])),
tailContent: PropTypes.any,
icons: PropTypes.shape({
finish: PropTypes.any,
error: PropTypes.any,
}).loose,
onClick: PropTypes.func,
onStepClick: PropTypes.func,
stepIcon: PropTypes.func,
},
props: VcStepProps(),
slots: ['title', 'subTitle', 'description', 'tailContent', 'stepIcon', 'progressDot'],
emits: ['click', 'stepClick'],
setup(props, { slots, emit }) {