Skip to content

步骤条StepBar

一、效果总览

二、描述

横向步骤条一种常见的导航形式

垂直步骤条常用于时间线的描述

三、构造函数及参数说明

typescript
OmniSteps({
  config: OmniStepsConfig,
  horizontalStepsStyle: OmniHorizontalStepsStyle,
  verticalStepsStyle: OmniVerticalStepsStyle
})
参数名参数类型描述是否必填默认值
configOmniStepsConfig步骤条数据配置
horizontalStepsStyleOmniHorizontalStepsStyle横向步骤条样式配置
verticalStepsStyleOmniVerticalStepsStyle纵向步骤条样式配置

OmniStepsConfig

参数名参数类型描述是否必填默认值
stepsTypeOmniStepsType横or竖
stepsCountnumber步骤数量
stepsOmniStepItemConfig[]步骤item配置
currentIndexnumber当前步骤下标

OmniStepItemConfig

参数名参数类型描述是否必填默认值
stateOmniStepState步骤状态
titlestring步骤标题
descstring步骤描述
doingIconResourceStr进行中icon
completedIconResourceStr已完成icon

四、代码演示

默认效果(横向)

typescript
//步骤条数据
@State private steps: OmniStepItemConfig[] = [
  {
    state: OmniStepState.Indexed,
    title: '第一步',
    desc: '辅助信息1'
  },
  {
    state: OmniStepState.Indexed,
    title: '第二步',
    desc: '辅助信息2'
  },
  {
    state: OmniStepState.Indexed,
    title: '第三步',
    desc: '辅助信息3'
  },
  {
    state: OmniStepState.Indexed,
    title: '第四步',
    desc: '辅助信息4'
  },
  {
    state: OmniStepState.Indexed,
    title: '第五步',
    desc: '辅助信息5'
  }
]


OmniSteps({
  config: {
    stepsType: OmniStepsType.Horizontal,
    stepsCount: this.steps.length,
    steps: this.steps,
    currentIndex: 0
  }
})

纵向步骤条

typescript
OmniSteps({
  config: {
    stepsType: OmniStepsType.Vertical,
    stepsCount: this.steps.length,
    steps: this.steps,
    currentIndex: 2
  }
})