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
  }
})