docs_vue2/one/docs/en-US/components/steps.md

90 lines
3.1 KiB
Markdown
Raw Normal View History

2020-08-13 11:47:56 +08:00
# Steps
## Demos
### Size and direction variants
Available style variants for the [`ui`](#props-ui) prop: `s` / `m` / `vertical` / `label-vertical`.
2020-08-13 11:47:56 +08:00
[[ demo src="/demo/steps/default.vue" ]]
### Step status
Set `status` property of the `step` to `error`, if the step fails.
[[ demo src="/demo/steps/status.vue" ]]
## API
### Props
| Name | Type | Default | Description |
| -- | -- | -- | -- |
| ``ui`` | `string=` | - | [^ui] |
| ``steps`` | `Array` | - | [^steps] |
| ``current`` | `number` | - | The index of current step. |
2020-08-13 11:47:56 +08:00
^^^ui
Style variants.
+++Enum values
| Value | Description |
| -- | -- |
| `s` | Small style. |
| `m` | Medium. |
| `vertical` | Vertical style. |
| `label-vertical` | Label vertical style. |
+++
^^^
^^^steps
The datasource of steps with item type being `{ label, desc, to, status }`.
+++Properties
| Name | Type | | Description |
| -- | -- | -- |
| `label` | `string` | The label of the step. |
| `desc` | `string` | The description of the step. |
| `to` | `string | Object` | The target link of the step. The type is the same as the [`to`](./link#props-to) prop of [`Link`](./link) component. |
2020-08-13 11:47:56 +08:00
| `status` | `string` | The statue of the step. Available variants are default normal and `error`. |
+++
^^^
### Slots
| Name | Description |
| -- | -- |
| ``default`` | [^slot-default] |
2022-01-24 18:53:52 +08:00
| ``index`` | The step index. Displays an index value starts from `1`, a success icon for finished steps by default and an error icon for error steps. Resides inside the [`default`](#slots-default) slot and share the same slot props. |
| ``label`` | The step label. Displays the `label` property by default. Resides inside the [`default`](#slots-default) slot and share the same slot props. |
| ``desc`` | The step description. Displays the `desc` property by default. Resides inside the [`default`](#slots-default) slot and share the same slot props. |
2020-08-13 11:47:56 +08:00
^^^slot-default
2020-08-13 11:47:56 +08:00
The content of each step. Displays the step index/completed icon, label and description by default.
2022-01-24 18:53:52 +08:00
+++Slot props
2020-08-13 11:47:56 +08:00
| Name | Type | Description |
| -- | -- | -- |
| `label` | `string` | The label of the step. Same as the `label` property from items of the [`steps`](#props-steps) prop. |
| `desc` | `string` | The description of the step. Same as the `desc` property from items of the [`steps`](#props-steps) prop. |
| `to` | `string | Object` | The target link of the step. Same as the `to` property from items of the [`steps`](#props-steps) prop. |
| `status` | `string` | The status of the step. Same as the `status` property from items of the [`steps`](#props-steps) prop. |
2020-08-13 11:47:56 +08:00
| `index` | `number` | The index of the step. (Starts from `0`.) |
2022-01-24 18:53:52 +08:00
Additionally, custom properties in current step, apart from the listed ones, will also be passes into the slot props object via `v-bind`.
2020-08-13 11:47:56 +08:00
+++
^^^
### Events
| Name | Description |
| -- | -- |
| ``click`` | Triggered when any step is clicked. The callback parameter type is `(index: number, event: Event)`, where `index` is the index of the clicked step and `event` is the corresponding native event object. |
2020-08-13 11:47:56 +08:00
### Icons
| Name | Description |
| -- | -- |
| ``success`` | Steps finished successfully. |
| ``error`` | Steps with error. |