Steps步骤条

引导用户按照流程完成任务的导航条。

何时使用#

当任务复杂或者存在先后关系时,将其分解成一系列步骤,从而简化任务。

import { NzStepsModule } from 'ng-zorro-antd/steps';

代码演示

Finished
This is a description.
2
In Progress
Left 00:00:08
This is a description.
3
Waiting
This is a description.

简单的步骤条。

expand codeexpand code
      加载中
    
Finished
2
In Progress
3
Waiting

迷你版的步骤条,通过设置 <nz-steps nzSize="small"> 启用.

expand codeexpand code
      加载中
    
4
Finished
5
In Progress
6
Waiting

通过 nzStartIndex 来设置步骤条的起始序号. 请注意 nzCurrent 也应该有对应的偏移.

expand codeexpand code
      加载中
    
Login
Verification
Pay
Done

通过设置 nz-stepnzIcon 属性,可以启用自定义图标。

expand codeexpand code
      加载中
    
1
Finished
2
In Progress
3
Waiting
First-content

通常配合内容及按钮使用,表示一个流程的处理进度。

expand codeexpand code
      加载中
    
Finished
This is a description.
2
In Progress
This is a description.
3
Waiting
This is a description.

简单的竖直方向的步骤条。

expand codeexpand code
      加载中
    
Finished
This is a description.
2
In Progress
This is a description.
3
Waiting
This is a description.

简单的竖直方向的小型步骤条。

expand codeexpand code
      加载中
    
Finished
This is a description.
In Progress
This is a description.
3
Waiting
This is a description.

使用 nz-stepsnzStatus 属性来指定当前步骤的状态。

expand codeexpand code
      加载中
    
Finished
This is a description.
In Progress
This is a description.
Waiting
This is a description.
Finished
This is a description. This is a description.
Finished
This is a description. This is a description.
In Progress
This is a description. This is a description.
Waiting
This is a description.
Waiting
This is a description.

包含步骤点的进度条。

expand codeexpand code
      加载中
    
Finished
You can hover on the dot.
In Progress
You can hover on the dot.
Waiting
You can hover on the dot.
Waiting
You can hover on the dot.

为点状步骤条增加自定义展示。

expand codeexpand code
      加载中
    
1
Finished
This is a description.
2
In Progress
This is a description.
3
Waiting
This is a description.
1
Finished
This is a description.
2
In Progress
This is a description.
3
Waiting
This is a description.

订阅 (nzIndexChange) 后,Steps 变为可点击状态。

expand codeexpand code
      加载中
    
Step 1
00:00:05
This is a description.
2
Step 2
00:01:02
This is a description.
3
Step 3
waiting for long long time
This is a description.
Step 1
2
Step 2
3
Step 3
4
Step 4
finish 1
finish 2
3
current process
4
wait

导航类型的步骤条。

expand codeexpand code
      加载中
    
1
Step 1
This step is synchronous.
2
Step 2
This step is asynchronous.
3
Step 3
This step is asynchronous.

异步执行的步骤带有圆形进度条。

expand codeexpand code
      加载中
    

API#

<nz-steps>
  <nz-step nzTitle="第一步"></nz-step>
  <nz-step nzTitle="第二步"></nz-step>
  <nz-step nzTitle="第三步"></nz-step>
</nz-steps>

nz-steps#

整体步骤条。

参数说明类型默认值
[nzType]步骤条类型,有 defaultnavigation 两种'default' | 'navigation'default
[nzCurrent]指定当前步骤,从 0 开始记数。在子 nz-step 元素中,可以通过 nzStatus 属性覆盖状态number0
[nzDirection]指定步骤条方向。目前支持水平(horizontal)和竖直(vertical)两种方向'vertical' | 'horizontal'horizontal
[nzLabelPlacement]指定标签放置位置,默认水平放图标右侧,可选 vertical 放图标下方'vertical' | 'horizontal'horizontal
[nzProgressDot]点状步骤条,可以设置为一个 TemplateRefboolean | TemplateRef<{ $implicit: TemplateRef<void>, status: string, index: number }>false
[nzSize]指定大小,目前支持普通(default)和迷你(small'small' | 'default''default'
[nzStatus]指定当前步骤的状态,可选 waitprocessfinisherror'wait' | 'process' | 'finish' | 'error''process'
[nzStartIndex]指定起始位置的序号number0
(nzIndexChange)点击单个步骤时触发的事件number-

nz-step#

步骤条内的每一个步骤。

参数说明类型默认值
[nzDescription]步骤的详情描述,可选string | TemplateRef<void>-
[nzIcon]步骤图标的类型,可选string | string[] | Set<string> | { [klass: string]: any; }TemplateRef<void>
[nzStatus]指定状态。当不配置该属性时,会使用 nz-stepsnzCurrent 来自动指定状态。可选:waitprocessfinisherror'wait' | 'process' | 'finish' | 'error''wait'
[nzTitle]标题string | TemplateRef<void>-
[nzSubtitle]子标题string | TemplateRef<void>-
[nzDisabled]禁用点击booleanfalse
[nzPercentage]当前状态为 process 的步骤所显示的进度条进度(只对基本类型的 nz-steps 生效)number-