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}
	}
相关推荐
engchina8 分钟前
@media 的常用场景与示例
css·media
林的快手27 分钟前
CSS列表属性
前端·javascript·css·ajax·firefox·html5·safari
匹马夕阳1 小时前
ECharts极简入门
前端·信息可视化·echarts
API_technology1 小时前
电商API安全防护:JWT令牌与XSS防御实战
前端·安全·xss
yqcoder1 小时前
Express + MongoDB 实现在筛选时间段中用户名的模糊查询
java·前端·javascript
一个处女座的程序猿O(∩_∩)O1 小时前
Uniapp 开发中遇到的坑与注意事项:全面指南
uni-app
Elena_Lucky_baby2 小时前
uniapp 网络请求封装(uni.request 与 uView-Plus)
uni-app
十八朵郁金香2 小时前
通俗易懂的DOM1级标准介绍
开发语言·前端·javascript
m0_528723813 小时前
HTML中,title和h1标签的区别是什么?
前端·html
Dark_programmer3 小时前
html - - - - - modal弹窗出现时,页面怎么能限制滚动
前端·html