步骤条
介绍
用于展示操作流程的各个环节,让用户了解当前的操作在整体流程中的位置。
#引入
在app.json或index.json中引入组件,详细介绍见快速上手
"usingComponents": {
"mx-steps": "/miniprogram_npm/m-ui/mx-steps/index",
}
#小程序码
可使用微信扫码查看小程序码
#

#代码演示
#基本用法
<mx-steps steps="{{ steps }}" active="{{ active }}" active-color="#267AFF"></mx-steps>
Page({
data: {
active: 0,
steps: [
{
text: '洗涤方式已确认',
time: '2021-05-18 21:10:29',
},
{
text: '洗涤方式已更新',
time: '2021-05-18 21:10:29',
},
{
text: '洗涤方案已上传',
desc: '您已经确定了具体洗涤方式',
time: '2021-05-18 21:10:29',
},
{
text: '步骤四',
desc: '描述信息',
time: '2021-05-18 21:10:29',
},
],
},
});
#自定义样式
可以通过 active-icon 和 active-color 属性设置激活状态下的图标和颜色。
<mx-steps
steps="{{ steps }}"
active="{{ active }}"
active-icon="success"
active-color="#38f"
/>
#自定义图标
可以通过 inactiveIcon 和 activeIcon 属性分别设置每一项的图标。
<mx-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属性来改变步骤条的显示方式。
<mx-steps
steps="{{ steps }}"
active="{{ active }}"
direction="horizontal"
active-color="#267AFF"
/>
#API
#Props
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
active |
当前步骤 | number | 0 |
steps |
步骤配置集合,见下面配置项 | Step 配置项数组 | [] |
direction |
显示方向,可选值为 horizontal vertical(horizontal 样式混乱) | string | vertical |
active-color |
激活状态颜色 | string | #267AFF |
inactive-color |
未激活状态颜色 | string | #c7c7cc |
active-icon |
激活状态底部图标 (目前纵向不支持换图标) | string | - |
inactive-icon |
未激活状态底部图标 (目前纵向不支持换图标) | string | - |
#Event
| 事件名 | 说明 | 回调参数 |
|---|---|---|
bind:click-step |
点击步骤时触发的事件 | event.detail:当前步骤的索引 |
#外部样式类
| 类名 | 说明 |
|---|---|
custom-class |
根节点样式类 |
desc-class |
描述信息样式类 |
#Step 配置项
| 名称 | 说明 |
|---|---|
text |
当前步骤名称 |
desc |
当前步骤描述信息 |
time |
当前步骤时间 |
activeIcon |
当前步骤激活状态底部图标(目前不支持更换图标) |
inactiveIcon |
当前步骤未激活状态底部图标(目前不支持更换图标) |
浙公网安备 33010602011771号