Steps 步骤条 VIP专属

概述

Steps 步骤条,显示一个任务的进度或者引导用户完成某个复杂任务。

# 支持平台

App-vue App-Nvue 微信小程序 支付宝小程序 百度小程序 字节小程序 QQ小程序 H5 PC 快手小程序 钉钉小程序

温馨提示

Nvue端如果组件外层容器设置了样式 flex-direction: row 导致步骤条内容被裁剪,解决方法如下:

第一种方法:同时设置样式 align-items: flex-start

第二种方法:将 flex-direction: row 改为 flex-direction: column

# 引入

以下介绍两种常用的引入方式。
第一种:在页面中引用、注册
import fuiSteps from "@/components/firstui/fui-steps/fui-steps.vue"
export default {
	components:{
		fuiSteps
	}
}
1
2
3
4
5
6
第二种:easycom组件规范
传统vue组件,需要安装、引用、注册,三个步骤后才能使用组件。easycom将其精简为一步。

First UI easycom配置请查看 快速上手

如果不了解easycom,可先查看 官网文档 (opens new window)

# 代码演示

部分示例演示,完整使用请参考示例程序以及文档API(以下示例写于.vue页面中)。
基础使用

通过 items 属性设置步骤条数据,current 属性指定当前步骤,从 0 开始记数。

<fui-steps :items="items" :current="current"></fui-steps>
1
data() {
	return {
		current: 0,
		items: [{
			title: '注册'
		}, {
			title: '激活邮箱'
		}, {
			title: '注册完成'
		}]
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
数字节点

通过 items 属性设置步骤条数据,current 属性指定当前步骤,从 0 开始记数,activeColor 属性设置已完成的步骤颜色。

<fui-steps :items="items" :current="current" activeColor="#FF2B2B"></fui-steps>
1
data() {
	return {
		current: 0,
		items: [{
			title: '注册',
			text: '1'
		}, {
			title: '激活邮箱',
			text: '2'
		}, {
			title: '注册完成',
			text: '3'
		}]
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
纵向展示

通过 items 属性设置步骤条数据,current 属性指定当前步骤,从 0 开始记数,direction 属性设置展示方向,padding 属性设置步骤条外层内边距。

<fui-steps :items="items" :current="current" direction="column" :padding="['0','32rpx']"></fui-steps>
1
data() {
	return {
		current: 0,
		items: [{
			title: '注册',
			text: '1'
		}, {
			title: '激活邮箱',
			text: '2'
		}, {
			title: '注册完成',
			text: '3'
		}]
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

# Slots

插槽名称 说明
- -

# Props

属性名 类型 说明 默认值 平台差异说明
items Array 步骤条数据,详细参数见下方说明 [ ] -
current Number, String 指定当前步骤,从 0 开始记数。 0 -
direction String 步骤条展示方向,可选值:row(横向)/column(纵向)。 row -
padding Array 步骤条外层内边距,[上,右,下,左],可简写为[上,右] [ ] -
background String 步骤条外层背景色 transparent -
height Number, String 步骤条节点外层高度,当direction=column时为节点外层宽度,单位rpx 50 -
nodeColor String 节点颜色 #ccc -
color String 标题字体颜色 #181818 -
size Number, String 标题字体大小,单位rpx 32 -
fontWeight Number, String 标题字体字重 400 -
descrColor String 描述信息字体颜色 #B2B2B2 -
descrSize Number, String 描述信息字体大小,单位rpx 24 -
activeColor String 已完成步骤高亮颜色 #465CFF 非Nvue端默认为空,可使用css变量(--fui-color-primary)来修改颜色值
processStatus V1.9.8+ String 当前步骤的状态,可选值: wait / fail / success - -
processColor V1.9.8+ String 当前步骤的高亮颜色 - -
radius String 当节点使用自定义图标时,图标圆角值 0rpx -
isMark Boolean 当前步骤是否需要对号标识 true -
isWait Boolean 是否为进行中,连接下一步骤线条一半高亮,仅direction=row时有效 false -
lineBold V1.9.8+ Boolean 步骤条线条是否加粗 false -
itemGap V2.1.0+ Number, String item项之间间隔,单位rpx,仅纵向有效 64 -
lineThrough V2.1.0+ Boolean 当默认节点为小圆点时线条是否贯穿,仅横向有效 false -
//items 数据格式说明
//以下为约定属性,其他属性可自行增加
options: [{
	//标题
	title:'步骤一',
	//描述信息,可选
	descr:'步骤一描述',
	//节点文本,可选
	text: '',
	//节点自定义图标src值,可选(text为空时有效)
	src: '',
	//步骤完成后自定义图标src值,可选(text为空且isMark为false时有效)
	activeSrc:''
}]
1
2
3
4
5
6
7
8
9
10
11
12
13
14

# Events

事件名 说明 回调参数
@click 点击步骤内容时触发 {
  index:当前步骤索引,
  ...this.items[index]
}

示例预览

# 示例代码地址

VIP内容代码请查看订单页下载的组件库示例源码。

# 特别说明

该组件为付费组件,UNI-APP版VIP用户可免费使用 。

开通会员 (opens new window)

Last Updated: 8/18/2023, 5:05:05 PM