uniapp步骤条 组件

该篇文章详细描述了如何使用Vue构建一个带有动态步骤指示和进度条的子组件,通过props接收父组件传递的步数和步骤列表数据,用于显示用户操作流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

//子组件
<template>
	<view class="container-step">
		<view class="uni-padding-wrap">
			<view class="progress-box">
				<progress :percent="3" active="true"   stroke-width="2" />
			</view>
			<view class="progress-bar">
				<view class="bar-item"  v-for="(item,index) in stepList" :key="index" :class="showStep>=index+1?'itemActive':'itemDefault'">
					<view class="bar-round">{{item.step}}</view>
					<view class="bar-info">{{item.name}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			showStep: {
				type: Number,
				default: 1
			},
			stepList: {
				type: Array,
				default: function(){
				 return	[{step:1,name:'基本信息'},{step:2,name:'发票信息'},{step:3,name:'上传附件'}]
				}
			}
			}
		}
	}
</script>

<style scoped>
	.uni-padding-wrap {
		width: 750upx;
		height: 130upx;
		background: #F5F8FB;

		.progress-box {
			padding: 42upx 80upx 27upx 80upx;
		}

		.progress-bar {
			display: flex;
			justify-content: space-between;
			position: relative;
			top: -42upx;

			.bar-item {
				display: flex;
				flex-direction: column;
				text-align: center;

				.bar-round {
					width: 30upx;
					height: 30upx;
					color: #ffffff;
					/* background: #999999; */
					border-radius: 50%;
					font-size: 18upx;
					line-height: 30upx;
					text-align: center;
					margin: 0 80upx;
					margin-bottom: 6upx;
				}

				.bar-info {
					color: #999999;
					font-size: 24upx;
					margin: 0 40upx;
				}

			}

			.itemActive {
				.bar-round {
					background: #288FF6;
				}
				.bar-info {
					color: #288FF6;
				}
			}

			.itemDefault {
				.bar-round {
					background: #999999;
				}
				.bar-info {
					color: #999999;
				}
			}
		}
	}
</style>

父组件引用

<template>
<!--:stepList=[你需要传的值] :showStep=第几步->
<step-page :showStep="3" />
</template>
<script>
	import stepPage from '@/components/stepPage/index'
	export default {
	components: {stepPage}
	}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值