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}
	}
相关推荐
Jonathan Star6 小时前
沉浸式雨天海岸:用A-Frame打造WebXR互动场景
前端·javascript
工业甲酰苯胺7 小时前
实现 json path 来评估函数式解析器的损耗
java·前端·json
老前端的功夫7 小时前
Web应用的永生之术:PWA落地与实践深度指南
java·开发语言·前端·javascript·css·node.js
LilySesy7 小时前
ABAP+WHERE字段长度不一致报错解决
java·前端·javascript·bug·sap·abap·alv
Wang's Blog8 小时前
前端FAQ: Vue 3 与 Vue 2 相⽐有哪些重要的改进?
前端·javascript·vue.js
再希8 小时前
React+Tailwind CSS+Shadcn UI
前端·react.js·ui
用户47949283569159 小时前
JavaScript 的 NaN !== NaN 之谜:从 CPU 指令到 IEEE 754 标准的完整解密
前端·javascript
群联云防护小杜9 小时前
国产化环境下 Web 应用如何满足等保 2.0?从 Nginx 配置到 AI 防护实战
运维·前端·nginx
醉方休9 小时前
Web3.js 全面解析
前端·javascript·electron
前端开发爱好者10 小时前
前端新玩具:Vike 发布!
前端·javascript