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}
	}
相关推荐
晓得迷路了19 小时前
栗子前端技术周刊第 98 期 - NPM 生态遭受攻击、Rspack 1.5.3、Storybook 10 beta...
前端·javascript·css
江城开朗的豌豆19 小时前
解密DVA:React应用的状态管理利器
前端·javascript·react.js
带娃的IT创业者19 小时前
《Python Web部署应知应会》No3:Flask网站的性能优化和实时监测深度实战
前端·python·flask
weixin_4316004419 小时前
使用 vue-virtual-scroller 实现高性能传输列表功能总结
前端·javascript·vue.js
OEC小胖胖19 小时前
App Router vs. Pages Router:我应该如何选择?
开发语言·前端·前端框架·web·next.js
Wiktok20 小时前
【Wit】pure-admin后台管理系统前端与FastAPI后端联调通信实例
前端·vue3·pureadmin
陆康永20 小时前
弹窗分页保留其他页面勾选的数据(vue)
前端·javascript·vue.js
IT_陈寒20 小时前
Vite 5.0重磅升级:8个性能优化秘诀让你的构建速度飙升200%!🚀
前端·人工智能·后端
Run Freely93720 小时前
Ajax-day2(图书管理)-弹框显示和隐藏
前端·javascript·ajax
GDAL20 小时前
Knockout.js Virtual Elements 详解
前端·javascript·knockout