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}
	}
相关推荐
白臻24 分钟前
小程序字体图标使用iconfont 阿里巴巴矢量图
前端·javascript·小程序
吾名招财31 分钟前
6-6 Ant.design配置(react+区块链实战)
前端·react.js·区块链
weixin_4427331138 分钟前
【React Hooks原理 - useRef】
前端·javascript·react.js
Sun_Sherry1 小时前
React:useState和useEffect
前端·react.js
Live&&learn1 小时前
在uniapp中如何使用地图
uni-app
Edwin_jada1 小时前
uni-app 保存号码到通讯录
uni-app
前端专业写bug1 小时前
uniapp安卓离线打包配置scheme url
android·uni-app
下雪天的夏风2 小时前
React@16.x(55)Redux@4.x(4)- store
前端·javascript·react.js
玖玥西3 小时前
html5——CSS3_文本样式属性
前端·css·html·css3·html5·web
卓卓没头发3 小时前
Vue Router 4:构建高效单页面应用的路由管理
前端·javascript·vue.js