用uni-app写的开灯、关灯的面板界面

一款用uni-app写的开灯、关灯的面板界面,直接复制即可使用

废话不多说,代码如下,直接拷贝即可使用:

index.vue文件

javascript 复制代码
<template>
	<view class="content" :style="status?'background-color: #eeeeee;':'background-color: #4e4e57;'">
		<view class="box" style="background-color: #c7c9ca;" v-show="status" @click="switchClick">
			<view class="open-main">
				<view class="open">
					<view class="upper"></view>
					<view class="below"></view>
				</view>
			</view>
		</view>
		<view class="box" style="background-color: #43444d;" v-show="!status" @click="switchClick">
			<view class="close-main">
				<view class="close">
					<view class="upper"></view>
					<view class="below"></view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				status: true
			}
		},
		onReady() {},
		methods: {
			switchClick() {
				this.status = !this.status
			}
		}
	}
</script>

<style lang="scss">
	.content {
		width: 100vw;
		height: 100vh;
		display: flex;
		justify-content: center;
	}

	.box {
		display: flex;
		justify-content: center;
		align-items: center;
		margin-top: 30vh;
		width: 200rpx;
		height: 300rpx;
		border-radius: 40rpx;

		.open-main {
			display: flex;
			justify-content: center;
			align-items: flex-end;
			width: 170rpx;
			height: 270rpx;
			border-radius: 40rpx;
			border: 4rpx solid #949595;
			background: linear-gradient(to bottom, #e6e6e6, #e7e7e8);

			.open {
				position: relative;
				width: 162rpx;
				height: 240rpx;
				border-radius: 40rpx;
				background: linear-gradient(to bottom, #b4b5b6, #e3e4e4);

				.upper {
					position: absolute;
					top: 36rpx;
					left: 62rpx;
					width: 30rpx;
					height: 34rpx;
					border: 4rpx solid #6d6d6d;
					border-radius: 50rpx;
				}

				.below {
					position: absolute;
					top: 170rpx;
					left: 80rpx;
					width: 4rpx;
					height: 44rpx;
					background-color: #777777;
				}
			}
		}

		.close-main {
			display: flex;
			justify-content: center;
			align-items: flex-start;
			width: 170rpx;
			height: 270rpx;
			border-radius: 40rpx;
			border: 4rpx solid #2e2e37;
			background: linear-gradient(to bottom, #3a3a42, #3f3f47);

			.close {
				position: relative;
				width: 162rpx;
				height: 240rpx;
				border-radius: 40rpx;
				background: linear-gradient(to bottom, #474750, #5a5a63);

				.upper {
					position: absolute;
					top: 36rpx;
					left: 62rpx;
					width: 30rpx;
					height: 34rpx;
					border: 4rpx solid #2e2e37;
					border-radius: 50rpx;
				}

				.below {
					position: absolute;
					top: 170rpx;
					left: 80rpx;
					width: 4rpx;
					height: 44rpx;
					background-color: #2e2e37;
				}
			}
		}
	}
</style>

需要上百款登录注册界面模板的朋友可以点击查看:https://ext.dcloud.net.cn/plugin?id=8937。

相关推荐
anyup1 小时前
2026第一站:分享我在高德大赛现场学到的技术、产品与心得
前端·架构·harmonyos
BBBBBAAAAAi1 小时前
Claude Code安装记录
开发语言·前端·javascript
xiaolyuh1232 小时前
【XXL-JOB】 GLUE模式 底层实现原理
java·开发语言·前端·python·xxl-job
源码获取_wx:Fegn08952 小时前
基于 vue智慧养老院系统
开发语言·前端·javascript·vue.js·spring boot·后端·课程设计
毕设十刻2 小时前
基于Vue的人事管理系统67zzz(程序 + 源码 + 数据库 + 调试部署 + 开发环境配置),配套论文文档字数达万字以上,文末可获取,系统界面展示置于文末
前端·数据库·vue.js
anyup2 小时前
从赛场到产品:分享我在高德大赛现场学到的技术、产品与心得
前端·harmonyos·产品
前端工作日常2 小时前
我学习到的A2UI的功能:纯粹的UI生成
前端
Jing_Rainbow2 小时前
【 前端三剑客-37 /Lesson61(2025-12-09)】JavaScript 内存机制与执行原理详解🧠
前端·javascript·程序员
UIUV3 小时前
模块化CSS学习笔记:从作用域问题到实战解决方案
前端·javascript·react.js
aoi3 小时前
解决 Vue 2 大数据量表单首次交互卡顿 10s 的性能问题
前端·vue.js