element/examples/docs/en-US/steps.md

140 lines
4.2 KiB
Markdown
Raw Normal View History

<script>
export default {
data() {
return {
active: 0
};
},
methods: {
next() {
if (this.active++ > 2) this.active = 0;
}
}
}
</script>
2016-11-13 02:44:15 +00:00
## Steps
2016-11-13 03:58:45 +00:00
Guide the user to complete tasks in accordance with the process. Its steps can be set according to the actual application scenario and the number of the steps can't be less than 2.
2016-11-13 03:58:45 +00:00
### Basic usage
Simple step bar.
2016-11-13 03:58:45 +00:00
:::demo Set `active` attribute with `Number` type, which indicates the index of steps and starts from 0. You can set `space` attribute when the width of the step needs to be fixed which accepts `Boolean` type. The unit of the `space` attribute is `px`. If not set, it is responsive. Setting the `finish-status` attribute can change the state of the steps that have been completed.
```html
<el-steps :space="100" :active="active" finish-status="success">
<el-step title="Step 1"></el-step>
<el-step title="Step 2"></el-step>
<el-step title="Step 3"></el-step>
</el-steps>
2016-11-20 14:39:33 +00:00
<el-button style="margin-top: 12px;" @click="next">Next step</el-button>
<script>
export default {
data() {
return {
active: 0
};
},
methods: {
next() {
if (this.active++ > 2) this.active = 0;
}
}
}
</script>
```
:::
### Step bar that contains status
Shows the status of the step for each step.
2016-11-13 03:58:45 +00:00
:::demo Use `title` attribute to set the name of the step, or override the attribute by using a named `slot`. We have listed all the slot names for you at the end of this page.
```html
<el-steps :space="100" :active="1" finish-status="success">
<el-step title="Done"></el-step>
<el-step title="Processing"></el-step>
<el-step title="Step 3"></el-step>
</el-steps>
```
:::
### Step bar with description
There is description for each step.
:::demo
```html
<el-steps :space="200" :active="1">
2016-11-13 03:58:45 +00:00
<el-step title="Step 1" description="Some description"></el-step>
<el-step title="Step 2" description="Some description"></el-step>
<el-step title="Step 3" description="Some description"></el-step>
</el-steps>
```
:::
### Step bar with icon
A variety of custom icons can be used in the step bar.
2016-11-13 03:58:45 +00:00
:::demo The icon is set by the `icon` property. The types of icons can be found in the document for the Icon component. In addition, you can customize the icon through a named `slot`.
```html
<el-steps :space="100" :active="1">
<el-step title="Step 1" icon="edit"></el-step>
<el-step title="Step 2" icon="upload"></el-step>
<el-step title="Step 3" icon="picture"></el-step>
</el-steps>
```
:::
### Vertical step bar
Vertical step bars.
:::demo You only need to set the `direction` attribute to` vertical` in the `el-steps` element.
```html
<el-steps :space="100" direction="vertical" :active="1">
<el-step title="Step 1"></el-step>
<el-step title="Step 2"></el-step>
<el-step title="Step 3"></el-step>
</el-steps>
```
:::
### Steps Attributes
2016-11-13 03:58:45 +00:00
| Attribute | Description | Type | Accepted Values | Default |
|---------- |-------- |---------- |------------- |-------- |
2017-01-19 09:44:27 +00:00
| space | the spacing of each step, will be responsive if omitted. Support percentage. | Number,String | — | — |
| direction | display direction | string | vertical/horizontal | horizontal |
2016-11-13 03:58:45 +00:00
| active | current activation step | number | — | 0 |
| process-status | status of current step | string | wait/process/finish/error/success | process |
| finish-status | status of end step | string | wait/process/finish/error/success | finish |
| align-center | whether step description is centered | boolean | — | false |
2017-01-11 10:43:58 +00:00
| center | center whole `Steps` component | boolean | - | false |
### Step Attributes
2016-11-13 03:58:45 +00:00
| Attribute | Description | Type | Accepted Values | Default |
|---------- |-------- |---------- |------------- |-------- |
2016-11-13 03:58:45 +00:00
| title | step title | string | — | — |
| description | step description | string | — | — |
2016-12-13 14:52:29 +00:00
| icon | step icon | icons provided by Element Icon. Can be overwritten by a named slot if you want to use custom icons | string | — |
| status | current status. It will be automatically set by Steps if not configured. | wait/process/finish/error/success | - |
### Step Slot
2016-11-13 03:58:45 +00:00
| Name | Description |
|----|----|
2016-11-13 03:58:45 +00:00
| icon | custom icon |
| title | step title |
| description | step description |