From bbfe451d5ee74b76209c3450c03be02fb95d08d7 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Fri, 26 Nov 2021 21:48:35 +0800 Subject: [PATCH] fix: step type error #4908 close #4908 --- components/steps/index.tsx | 3 ++- components/vc-steps/Step.tsx | 51 ++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/components/steps/index.tsx b/components/steps/index.tsx index e1f10a4ef..c445b8395 100644 --- a/components/steps/index.tsx +++ b/components/steps/index.tsx @@ -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) => { diff --git a/components/vc-steps/Step.tsx b/components/vc-steps/Step.tsx index 33497eb0d..1cbb0a07a 100644 --- a/components/vc-steps/Step.tsx +++ b/components/vc-steps/Step.tsx @@ -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 }) {