# stepper - [权限列表](#zh-cn_topic_0000001173324583_section11257113618419) - [子组件](#zh-cn_topic_0000001173324583_section9288143101012) - [属性](#zh-cn_topic_0000001173324583_section191521418142311) - [样式](#zh-cn_topic_0000001173324583_section72591594253) - [事件](#zh-cn_topic_0000001173324583_section69611614182911) - [方法](#zh-cn_topic_0000001173324583_section1954212182148) - [示例](#zh-cn_topic_0000001173324583_section15374183712313) 步骤导航器。当完成一个任务需要多个步骤时,可以使用步骤导航器展示当前进展。 >![](../../public_sys-resources/icon-note.gif) **说明:** >从API Version 5 开始支持。 ## 权限列表 无 ## 子组件 仅支持子组件。 >![](../../public_sys-resources/icon-note.gif) **说明:** >步骤导航器内的步骤顺序按照子组件的顺序进行排序。 ## 属性 除支持[通用属性](js-components-common-attributes.md#ZH-CN_TOPIC_0000001163812208)外,还支持如下属性:

名称

类型

默认值

描述

index

number

-

设置步骤导航器步骤显示第几个stepper-item子组件。

## 样式 支持[通用样式](js-components-common-styles.md#ZH-CN_TOPIC_0000001163932190)。 >![](../../public_sys-resources/icon-note.gif) **说明:** >stepper组件默认占满父容器大小,建议父组件使用应用窗口大小(或者父组件为根节点)来优化体验。 ## 事件 除支持[通用事件](js-components-common-events.md#ZH-CN_TOPIC_0000001209412119)外,还支持如下事件:

名称

参数

描述

finish

当步骤导航器最后一个步骤完成时触发该事件。

skip

当通过setNextButtonStatus方法设置当前步骤导航器可跳过时,点击右侧跳过按钮触发该事件。

change

{ prevIndex:prevIndex, index: index}

当步骤导航器点击左边或者右边文本按钮进行步骤切换时触发该事件,prevIndex表示老步骤的序号,index表示新步骤的序号。

next

{ index:index, pendingIndex: pendingIndex }

当用户点击下一步按钮时触发该事件,index表示当前步骤序号,pendingIndex表示将于跳转的序号,该事件有返回值,返回值格式为:{ pendingIndex:pendingIndex },可以通过指定pendingIndex来修改下一个步骤使用哪个stepper-item子组件。

back

{ index:index, pendingIndex: pendingIndex }

当用户点击上一步按钮时触发该事件,index表示当前步骤序号,pendingIndex表示将于跳转的序号,该事件有返回值,返回值格式为Object:{ pendingIndex:pendingIndex },可以通过指定pendingIndex来修改上一个步骤使用哪个stepper-item子组件。

## 方法 除支持[通用方法](js-components-common-methods.md#ZH-CN_TOPIC_0000001209252157)外,支持如下方法:

名称

参数

描述

setNextButtonStatus

{ status: string, label: label }

设置当前步骤导航器下一步文本按钮的状态,参数中status类型为string,可选值为:

  1. normal:正常状态,下一步文本按钮正常显示,可点击进入下一个步骤;
  2. disabled:不可用状态,下一步文本按钮灰度显示,不可点击进入下一个步骤;
  3. waiting:等待状态,下一步文本按钮不显示,使用等待进度条,不可点击进入下一个步骤。
  4. skip:跳过状态,下一步文本按钮显示跳过按钮,点击时会跳过剩下步骤。
## 示例 ```
First screen
Second screen
Third screen
``` ``` /* xxx.css */ .container { margin-top: 20px; flex-direction: column; align-items: center; height: 300px; } .stepperItem { flex-direction: column; align-items: center; } .stepperItemContent { color: #0000ff; font-size: 50px; justify-content: center; } .button { width: 60%; margin-top: 30px; justify-content: center; } ``` ``` // xxx.js export default { data: { label_1: { prevLabel: 'BACK', nextLabel: 'NEXT', status: 'normal' }, label_2: { prevLabel: 'BACK', nextLabel: 'NEXT', status: 'normal' }, label_3: { prevLabel: 'BACK', nextLabel: 'NEXT', status: 'normal' }, }, setRightButton(e) { this.$element('mystepper').setNextButtonStatus({status: 'skip', label: 'SKIP'}); }, nextclick(e) { var index = { pendingIndex: e.pendingIndex } return index; }, backclick(e) { var index = { pendingIndex: e.pendingIndex } return index; }, } ``` ![](figures/Video_2021-03-26_154549.gif)