Step
Examples
Style variants
Available ui
prop values: s
/ m
/ dot
/ vertical
/ label-vertical
.
The stateless
prop can be used to switch to a pure display style without state.
3
Step 3
注册成功
<template>
<article>
<section class="settings">
<veui-label>
Current step <veui-number-input
v-model="current"
ui="s"
:min="1"
:max="steps.length"
:step="1"
/>
</veui-label>
<veui-radio-button-group
v-model="style"
ui="s"
:items="styles"
/>
<veui-radio-button-group
v-model="size"
ui="s"
:items="sizes"
/>
<veui-radio-button-group
v-model="direction"
ui="s"
:items="directions"
/>
<veui-checkbox
v-model="stateless"
ui="s"
>
Stateless
</veui-checkbox>
</section>
<section>
<veui-steps
:ui="ui"
:steps="steps"
:current="current - 1"
:stateless="stateless"
/>
</section>
</article>
</template>
<script>
import { Steps, Label, NumberInput, RadioButtonGroup, Checkbox } from 'veui'
export default {
components: {
'veui-steps': Steps,
'veui-label': Label,
'veui-number-input': NumberInput,
'veui-radio-button-group': RadioButtonGroup,
'veui-checkbox': Checkbox
},
data () {
return {
current: 1,
size: 'm',
direction: '',
style: 'normal',
sizes: [
{
label: 's',
value: 's'
},
{
label: 'm',
value: 'm'
}
],
stateless: false,
directions: [
{
label: 'vertical',
value: 'vertical'
},
{
label: 'label-vertical',
value: 'label-vertical'
},
{
label: 'default',
value: ''
}
],
styles: [
{
label: 'normal',
value: 'normal'
},
{
label: 'dot',
value: 'dot'
}
],
steps: [
{ label: 'Step 1', desc: '填写信息' },
{ label: 'Step 2', desc: '验证身份' },
{ label: 'Step 3', desc: '注册成功' }
]
}
},
computed: {
ui () {
return [
this.style,
this.size,
this.style === 'dot' && this.direction === ''
? 'label-vertical'
: this.direction
].join(' ')
}
}
}
</script>
<style lang="less" scoped>
.settings {
display: flex;
margin-bottom: 32px;
gap: 16px;
align-items: center;
}
</style>
Step status
The step status can be automatically defined by setting the status
of the steps
property data item. If the step is in error, it can be set to error
.
Current step
3
Step 3
注册成功
<template>
<article>
<section>
<h4>Current step</h4>
<veui-number-input
v-model="current"
:min="1"
:max="steps.length"
:step="1"
/>
</section>
<section>
<veui-steps
:steps="steps"
:current="current - 1"
/>
</section>
</article>
</template>
<script>
import { Steps, NumberInput } from 'veui'
export default {
components: {
'veui-steps': Steps,
'veui-number-input': NumberInput
},
data () {
return {
current: 2,
steps: [
{ label: 'Step 1', desc: '填写信息' },
{ label: 'Step 2', desc: '验证身份', status: 'error' },
{ label: 'Step 3', desc: '注册成功' }
]
}
}
}
</script>
<style lang="less" scoped>
h4 {
margin: 0 0 10px;
}
section {
margin-bottom: 10px;
}
section + section {
margin-top: 20px;
}
</style>
API
Props
Name | Type | Default | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ui | string | - | Predefined styles.
| ||||||||||||
steps | Array | - | Step data source. The type is | ||||||||||||
current | number | - | The index value of the current step. | ||||||||||||
stateless | boolean | false | Whether to use a pure display style without state. |
Slots
Name | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
default | The content of the entire step item. Default content: index/completion icon, step title, description, and other content.
In addition, properties other than those described above in the | ||||||||||||||||||
index | The content of the index part. By default, the index starts from 1 , completed steps display a completion icon, and error steps display an error icon. It is located inside the default slot, and the slot parameters are the same as those of the default slot. | ||||||||||||||||||
label | The content of the step title. By default, it displays the label field of the project in steps . It is located inside the default slot, and the slot parameters are the same as those of the default slot. | ||||||||||||||||||
desc | The content of the step description. By default, it displays the desc field of the project in steps . It is located inside the default slot, and the slot parameters are the same as those of the default slot. |
Events
Name | Description |
---|---|
click | Triggered after any step is clicked. The callback parameter is (index: number, event: Event) . index is the index value of the clicked step, and event is the corresponding native event object. |
Icons
Name | Description |
---|---|
success | Completed step. |
error | Error step. |