当前位置: 首页 > article >正文

uniapp的锁屏上文字的显示与隐藏

元素居中的方法

.父元素{
    position:relative;
    .子元素{
        left:0;
        right:0;
        margin:auto;
        width: fit-content;//随内容变化设置宽度
    
}
}
<template>
	<view class="lockScreen" @click="maskChange">
		<swiper circular>
			<swiper-item v-for="(item,index) in 6" :key="index">
				<image src="../../common/images/preview2.jpg" mode="aspectFill"></image>
			</swiper-item>
		</swiper>
		<view class="mask" v-show="maskState">
			<view class="goBack"></view>
			<view class="count">4 / 7</view>
			<view class="time">
				<uni-dateformat :date="new Date()" format="hh:mm"></uni-dateformat>
			</view>
			<view class="date">
				<uni-dateformat :date="new Date()" format="MM月dd日"></uni-dateformat>
			</view>
			<view class="footer">
				<view class="box">
					<uni-icons type="info" size="30"></uni-icons>
					<text class="typeface">信息</text>
				</view>
				<view class="box">
					<uni-icons type="star" size="30"></uni-icons>
					<text class="typeface">5分</text>
				</view>
				<view class="box">
					<uni-icons type="download" size="28"></uni-icons>
					<text class="typeface">下载</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import { ref } from 'vue';
	import { onShow } from "@dcloudio/uni-app";
	// 显示与隐藏
	const maskState =ref(true)
	const maskChange =()=>{
		maskState.value=!maskState.value
	}
</script>

<style lang="scss" scoped>
.lockScreen{
	width: 100%;
	height: 100vh;
	position: relative;
	swiper{
		width: 100%;
		height: 100%;
		swiper-item{			
			image{
				width: 100%;
				height: 100%;
			}
		}
	}
	.mask{
		// 父级紧邻的子元素公用属性
		&>view{
			position: absolute;
			left:0;
			margin: auto;
			right: 0;
			width: fit-content;//随内容变化设置宽度
			color:#fff;
		}
		.goBack{
			
		}
		.count{
			top:12vh;
			background: rgba(0,0,0,0.3);
			border-radius: 40rpx;
			font-size: 24rpx;
			padding: 4rpx 28rpx;
			backdrop-filter: blur(10rpx);//设置模糊
		}
		.time{
			font-size: 140rpx;
			top:calc( 10vh + 50rpx);
			
		}
		.date{
			font-size: 30rpx;
			top:calc(10vh + 225rpx);
		}
		.footer{
			bottom: 10vh;
			display: flex;
			justify-content: space-between;
			background-color: #fff;
			height: 125rpx;
			border-radius:125rpx;
			.box{
				display: flex;
				flex-direction: column;
				align-items: center;
				padding:0 30rpx;
				justify-content: center;
				margin-left: 10rpx;
				margin-right: 10rpx;
				.typeface{
					color: $text-font-color-2;
				}
			}
		}
	}
}
</style>

 


http://www.kler.cn/news/283683.html

相关文章:

  • ES6中新增的Set方法详解
  • 小资人群“轻社交”需求与创新营销模式——以“2+1 链动模式小程序、AI 智能名片、S2B2C 商城系统”为例
  • 代码随想录Day 28|题目:122.买卖股票的最佳时机Ⅱ、55.跳跃游戏、45.跳跃游戏Ⅱ、1005.K次取反后最大化的数组和
  • 防抖函数 debounce debouncePromise
  • 获得两类相关点之间的线性关系
  • 简易STL实现 | List的实现
  • 【leetcode刷题记录】二叉树遍历
  • 易查分如何查询图片?
  • 梧桐数据库(WuTongDB):什么是“顺序扫描”
  • 1.3金融术语的宝典
  • PHP房产管理多终端系统灵活应对各种管理需求系统小程序源码
  • 16.神经网络 - 卷积层
  • Python-MNE-源空间和正模型07:修复BEM和头表面
  • Linux 7 静默安装oracle 19c 单机
  • 深度学习常见面试题(2024.8.30笔记)
  • 如何在知行之桥上通过业务单号查找原始报文?
  • 英文论文格式编辑(二)
  • redis list 单推送消息,批量消费消息,springboot实现
  • Nginx配置实例-负载均衡
  • 密码学(二)---DES、SM、RSA
  • c++中的匿名对象及内存管理及模版初阶
  • 【系统架构师软考】计算机网络知识(四)
  • 在类Unix操作系统(如Linux)上运行Windows应用程序方法小记
  • flutter和原生Android以及IOS开发相比有什么优缺点?
  • Gradio学习——图像流输出
  • ShenNiusModularity项目源码学习(3:用户登录)
  • MFC工控项目实例之七点击下拉菜单弹出对话框
  • Python使用总结之Flask-SocketIO介绍
  • 查看显卡cuda版本
  • PD协议沟通过程