Steps 步骤条
Steps 步骤条
介绍
用于展示操作流程的各个环节,让用户了解当前的操作在整体流程中的位置。
引入
在app.json或index.json中引入组件,详细介绍见快速上手。
"usingComponents": { "van-steps": "@vant/weapp/steps/index"}
代码演示
基础用法
<van-steps steps="{{ steps }}" active="{{ active }}" />
Page({ data: { steps: [ { text: '步骤一', desc: '描述信息', }, { text: '步骤二', desc: '描述信息', }, { text: '步骤三', desc: '描述信息', }, { text: '步骤四', desc: '描述信息', }, ], },});
自定义样式
可以通过 active-icon 和 active-color 属性设置激活状态下的图标和颜色。
<van-steps steps="{{ steps }}" active="{{ active }}" active-icon="success" active-color="#38f"/>
自定义图标
可以通过 inactiveIcon 和 activeIcon 属性分别设置每一项的图标。
<van-steps steps="{{ steps }}" active="{{ active }}" />
Page({ data: { steps: [ { text: '步骤一', desc: '描述信息', inactiveIcon: 'location-o', activeIcon: 'success', }, { text: '步骤二', desc: '描述信息', inactiveIcon: 'like-o', activeIcon: 'plus', }, { text: '步骤三', desc: '描述信息', inactiveIcon: 'star-o', activeIcon: 'cross', }, { text: '步骤四', desc: '描述信息', inactiveIcon: 'phone-o', activeIcon: 'fail', }, ], },});
竖向步骤条
可以通过设置direction属性来改变步骤条的显示方式。
<van-steps steps="{{ steps }}" active="{{ active }}" direction="vertical" active-color="#ee0a24"/>
API
Steps Props
| direction |
显示方向,可选值为 horizontal vertical |
string |
horizontal |
- |
|
|
|
|
|
| active-color |
激活状态颜色 |
string |
#07c160 |
- |
|
|
|
|
|
| inactive-color |
未激活状态颜色 |
string |
#969799 |
- |
|
|
|
|
|
| active-icon |
激活状态底部图标,可选值见 Icon 组件 |
string |
checked |
- |
|
|
|
|
|
| inactive-icon |
未激活状态底部图标,可选值见 Icon 组件 |
string |
- |
- |
|
|
|
|
|
Events
| bind:click-step |
点击步骤时触发的事件 |
event.detail:当前步骤的索引 |
|
|
|
外部样式类