From 784622e2d1be631eb175c9ef5aa84004f86a999d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BC=9F=E6=9D=B0?= <674416404@qq.com> Date: Fri, 15 Nov 2024 16:38:35 +0800 Subject: [PATCH] docs(steps): sync api --- src/steps/props.ts | 9 ++++++--- src/steps/step-item-props.ts | 8 ++++---- src/steps/steps.en-US.md | 13 +++++++------ src/steps/steps.md | 8 +++++--- src/steps/type.ts | 3 +-- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/steps/props.ts b/src/steps/props.ts index a0033eacff..0e3ecd4727 100644 --- a/src/steps/props.ts +++ b/src/steps/props.ts @@ -11,11 +11,11 @@ export default { /** 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成 */ current: { type: [String, Number] as PropType, - default: undefined, + default: undefined as TdStepsProps['current'], }, modelValue: { type: [String, Number] as PropType, - default: undefined, + default: undefined as TdStepsProps['current'], }, /** 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成,非受控属性 */ defaultCurrent: { @@ -35,7 +35,10 @@ export default { type: Array as PropType, }, /** 只读状态 */ - readonly: Boolean, + readonly: { + type: Boolean, + default: undefined, + }, /** 步骤条分割符 */ separator: { type: String as PropType, diff --git a/src/steps/step-item-props.ts b/src/steps/step-item-props.ts index 6156e98015..ffb00894c1 100644 --- a/src/steps/step-item-props.ts +++ b/src/steps/step-item-props.ts @@ -11,7 +11,7 @@ export default { /** 步骤描述 */ content: { type: [String, Function] as PropType, - default: '', + default: '' as TdStepItemProps['content'], }, /** 步骤描述,同 content */ default: { @@ -24,9 +24,9 @@ export default { /** 图标,默认显示内置图标,也可以自定义图标,值为 false 则不显示图标。优先级大于 `status` 定义的图标 */ icon: { type: [Boolean, Function] as PropType, - default: true, + default: true as TdStepItemProps['icon'], }, - /** 当前步骤的状态 */ + /** 当前步骤的状态:默认状态(未开始)、进行中状态、完成状态、错误状态 */ status: { type: String as PropType, default: 'default' as TdStepItemProps['status'], @@ -38,7 +38,7 @@ export default { /** 标题 */ title: { type: [String, Function] as PropType, - default: '', + default: '' as TdStepItemProps['title'], }, /** 当前步骤标识 */ value: { diff --git a/src/steps/steps.en-US.md b/src/steps/steps.en-US.md index 6a9e001bbd..60c2d82872 100644 --- a/src/steps/steps.en-US.md +++ b/src/steps/steps.en-US.md @@ -8,12 +8,12 @@ name | type | default | description | required -- | -- | -- | -- | -- current | String / Number | - | `v-model` and `v-model:current` is supported | N defaultCurrent | String / Number | - | uncontrolled property | N -layout | String | horizontal | options:horizontal/vertical | N +layout | String | horizontal | options: horizontal/vertical | N options | Array | - | Typescript:`Array` | N -readonly | Boolean | false | \- | N -separator | String | line | options:line/dashed/arrow | N -sequence | String | positive | options:positive/reverse | N -theme | String | default | options:default/dot | N +readonly | Boolean | undefined | \- | N +separator | String | line | options: line/dashed/arrow | N +sequence | String | positive | options: positive/reverse | N +theme | String | default | options: default/dot | N onChange | Function | | Typescript:`(current: string \| number, previous: string \| number, context?: { e?: MouseEvent }) => void`
| N ### Steps Events @@ -22,6 +22,7 @@ name | params | description -- | -- | -- change | `(current: string \| number, previous: string \| number, context?: { e?: MouseEvent })` | \- + ### StepItem Props name | type | default | description | required @@ -30,6 +31,6 @@ content | String / Slot / Function | '' | Typescript:`string \| TNode`。[see default | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N extra | String / Slot / Function | - | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N icon | Boolean / Slot / Function | true | Typescript:`boolean \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N -status | String | default | options:default/process/finish/error。Typescript:`StepStatus` `type StepStatus = 'default' \| 'process' \| 'finish' \| 'error'`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/steps/type.ts) | N +status | String | default | options: default/process/finish/error。Typescript:`StepStatus` `type StepStatus = 'default' \| 'process' \| 'finish' \| 'error'`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/tree/develop/src/steps/type.ts) | N title | String / Slot / Function | '' | Typescript:`string \| TNode`。[see more ts definition](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N value | String / Number | - | \- | N diff --git a/src/steps/steps.md b/src/steps/steps.md index e98f744b1b..b181ebf209 100644 --- a/src/steps/steps.md +++ b/src/steps/steps.md @@ -1,15 +1,16 @@ :: BASE_DOC :: ## API + ### Steps Props -名称 | 类型 | 默认值 | 说明 | 必传 +名称 | 类型 | 默认值 | 描述 | 必传 -- | -- | -- | -- | -- current | String / Number | - | 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成。支持语法糖 `v-model` 或 `v-model:current` | N defaultCurrent | String / Number | - | 当前步骤,即整个步骤条进度。默认根据步骤下标判断步骤的完成状态,当前步骤为进行中,当前步骤之前的步骤为已完成,当前步骤之后的步骤为未开始。如果每个步骤没有设置 value,current 值为步骤长度则表示所有步骤已完成。如果每个步骤设置了自定义 value,则 current = 'FINISH' 表示所有状态完成。非受控属性 | N layout | String | horizontal | 步骤条方向,有两种:横向和纵向。可选项:horizontal/vertical | N options | Array | - | 步骤条数据列表(作用和 StepItem 效果一样)。TS 类型:`Array` | N -readonly | Boolean | false | 只读状态 | N +readonly | Boolean | undefined | 只读状态 | N separator | String | line | 步骤条分割符。可选项:line/dashed/arrow | N sequence | String | positive | 步骤条顺序。可选项:positive/reverse | N theme | String | default | 步骤条风格。可选项:default/dot | N @@ -21,9 +22,10 @@ onChange | Function | | TS 类型:`(current: string \| number, previous: stri -- | -- | -- change | `(current: string \| number, previous: string \| number, context?: { e?: MouseEvent })` | 当前步骤发生变化时触发 + ### StepItem Props -名称 | 类型 | 默认值 | 说明 | 必传 +名称 | 类型 | 默认值 | 描述 | 必传 -- | -- | -- | -- | -- content | String / Slot / Function | '' | 步骤描述。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N default | String / Slot / Function | - | 步骤描述,同 content。TS 类型:`string \| TNode`。[通用类型定义](https://github.com/Tencent/tdesign-vue-next/blob/develop/src/common.ts) | N diff --git a/src/steps/type.ts b/src/steps/type.ts index b3a397d1b4..66a3ae3252 100644 --- a/src/steps/type.ts +++ b/src/steps/type.ts @@ -30,7 +30,6 @@ export interface TdStepsProps { options?: Array; /** * 只读状态 - * @default false */ readonly?: boolean; /** @@ -74,7 +73,7 @@ export interface TdStepItemProps { */ icon?: boolean | TNode; /** - * 当前步骤的状态 + * 当前步骤的状态:默认状态(未开始)、进行中状态、完成状态、错误状态 * @default default */ status?: StepStatus;