uniapp步骤条 组件

c 复制代码
//子组件
<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>

父组件引用

c 复制代码
<template>
<!--:stepList=[你需要传的值] :showStep=第几步->
<step-page :showStep="3" />
</template>
<script>
	import stepPage from '@/components/stepPage/index'
	export default {
	components: {stepPage}
	}
相关推荐
远山枫谷几秒前
uniapp + Vue 自定义组件封装:自定义样式从入门到实战
前端·vue.js
Lee川4 分钟前
JavaScript 中的 `this` 与变量查找:一场关于“身份”与“作用域”的深度博弈
前端·javascript·面试
顺遂2 小时前
基于Rokid CXR-M SDK的引导式作业辅导系统设计与实现
前端
代码搬运媛2 小时前
Generator 迭代器协议 & co 库底层原理+实战
前端
前端拿破轮2 小时前
从0到1搭建个人网站(三):用 Cloudflare R2 + PicGo 搭建高速图床
前端·后端·面试
功能啥都不会3 小时前
PM2 使用指南 - 踩坑记录
前端
HelloReader3 小时前
React 中 useState、useEffect、useRef 的区别与使用场景详解,终于有人讲明白了
前端
兆子龙3 小时前
CSS 里的「if」:@media、@supports 与即将到来的 @when/@else
前端
踩着两条虫3 小时前
AI 智能体如何重构开发工作流
前端·人工智能·低代码
代码老中医3 小时前
逃离"Div汤":2026年,当AI写了75%的代码,前端开发者还剩什么?
前端