用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。

相关推荐
星_离21 分钟前
《Vue 自定义指令注册技巧:从手动到自动,效率翻倍》
前端·vue.js
狗头大军之江苏分军21 分钟前
消耗 760万 Token 后,一文看懂了“小龙虾” OpenClaw 和 OpenCode 的区别
前端·后端
毛骗导演21 分钟前
万字解析 OpenClaw 源码架构-安全与权限
前端·架构
哇哇哇哇25 分钟前
vue3 ref解析
前端
哇哇哇哇25 分钟前
vue3 reactive解析
前端
光影少年41 分钟前
Vue的响应式原理?Vue2和Vue3有什么区别?
前端·vue.js·掘金·金石计划
孟祥_成都1 小时前
Cursor 要被淘汰了?开发者最应该关注的 10 个信号
前端·人工智能
cxxcode1 小时前
Sentry browserTracingIntegration 实现原理深度解析
前端
孟沐1 小时前
大白话理解 Java 序列化:对标前端 JSON.stringify/parse
前端
忘ci1 小时前
electron、edge.js调用C#动态链接库的一些问题
前端