移动端CSS实现小程序竖向步骤条

效果图:

 html代码:

<view class="cardBox mar-top20">
	<view class="head">
		<image class="image" src="/static/images/aShin/navigation.png"></image>
		<view class="title">预约充电说明</view>
	</view>
	<view class="stepBox">
		<view class="step pd-top10">
			<view class="stepLeft">
				<view class="num">1</view>
				<view class="line"></view>
			</view>
			<view class="stepRight">
				<view class="title">预约充电</view>
				<view class="content">按需要选择合适的终端、时间进行预约</view>
			</view>
		</view>
		<view class="step">
			<view class="stepLeft">
				<view class="num">2</view>
				<view class="line"></view>
			</view>
			<view class="stepRight">
				<view class="title">申请降锁、充电</view>
				<view class="content">通过个人预约记录或扫码方式,进入准备充电页面申请降锁停车、启动充电!(仅预约时段可操作)</view>
			</view>
		</view>
		<view class="step">
			<view class="stepLeft">
				<view class="num">3</view>
				<view class="line"></view>
			</view>
			<view class="stepRight">
				<view class="title">充电中</view>
				<view class="content">充电过程中,可通过预约订单查看当前充电进展,并根据需要停止充电!</view>
			</view>
		</view>
		<view class="step">
			<view class="stepLeft">
				<view class="num">4</view>
			</view>
			<view class="stepRight">
				<view class="title">离场</view>
				<view class="content">完成充电后,请在规定时间内离场,超时平台将收取超时占位费!</view>
			</view>
		</view>
	</view>
	<view class="borderLine"></view>
</view>

 scss代码:

.mar-top20{
    margin-top: 20px !important;
}

.pd-top10{
	padding-top: 10px;
}

.cardBox{
	width: 710rpx;
	min-height: 75px;
	margin: 0 auto;
	color: #000000;
	font-size: 14px;
	display: flex;
	flex-direction: column;
	position: relative;
	.head{
		width: 290rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-left: 10rpx;
		z-index: 5;
		background-color: #FFFFFF;
		.image{
			height: 50rpx;
			width: 50rpx;
		}
		.title{
			font-size: 14px;
			margin-left: 5px;
		}
	}
	.stepBox{
		width: 90%;
		height: 100%;
		margin: 0 auto;
		font-size: 12px;
		.step{
			display: flex;
			height: 100%;
			.stepLeft{
				// height: 100%;
				position: relative;
				.num{
					height: 55rpx;
					width: 55rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					border-radius: 50%;
					color: #1890FF;
					background-color: #D0E8FF;
				}
				.line{
					height: 100%;
					background-color: #bfbfbf;
					width: 1px;
					z-index: -1;
					display: flex;
					align-items: center;
					justify-content: center;
					position: absolute;
					top: 0;
					left: 50%;
					transform: translate(0%, 0%);
				}
			}
			.stepRight{
				height: 100%;
				margin-left: 20rpx;
				.title{
					width: fit-content;
					padding: 3px 10px;
					display: flex;
					justify-content: center;
					align-items: center;
					color: #1890FF;
					background-color: #D0E8FF;
					border-radius: 5px;
				}
				.content{
					font-size: 11px;
					height: 100%;
					color: #666666;
				}
			}
		}
	}
	.borderLine{
		position: absolute;
		top: 20rpx;
		left: 0;
		width: 100%;
		height: 100%;
		border-radius: 5px;
		border: 1px solid #309AFE;
		box-shadow:2px 2px 5px #d0c9c9;
	}
}

  • 1
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
UniApp 是一个基于 Vue.js 的跨平台框架,可以用于开发多个平台的应用程序。如果你想要自定义竖向步骤,可以通过使用 Vue.js 和 CSS实现。 首先,你可以创建一个组件来表示每个步骤,例如 Step.vue: ```vue <template> <div :class="{'step': true, 'active': isActive}">{{ index }}</div> </template> <script> export default { props: { index: { type: Number, required: true }, isActive: { type: Boolean, default: false } } } </script> <style scoped> .step { width: 50px; height: 50px; border-radius: 50%; line-height: 50px; text-align: center; background-color: #ccc; } .active { background-color: #ff0000; color: #fff; } </style> ``` 然后,在你的页面中使用这个组件来创建竖向步骤,例如 Steps.vue: ```vue <template> <div class="steps"> <step v-for="(step, index) in steps" :key="index" :index="index + 1" :is-active="currentStep === index + 1" /> </div> </template> <script> import Step from '@/components/Step.vue' export default { components: { Step }, data() { return { steps: ['Step 1', 'Step 2', 'Step 3'], currentStep: 1 } } } </script> <style scoped> .steps { display: flex; flex-direction: column; } </style> ``` 在上面的例子中,使用了一个数组来定义步骤的文本内容,然后通过 v-for 指令和 Step 组件来渲染每个步骤。通过给 Step 组件传递 `:is-active` 属性来判断当前步骤是否为激活状态。 这样,你就可以在 UniApp 中自定义竖向步骤了。根据你的需要,你可以根据具体的样式要求进行调整和扩展。希望对你有所帮助!如果你对这方面还有其他问题,可以继续问我。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值