uniapp 仿写弹窗

页面

复制代码
<template>
	<view @click="close" class="mask">
		<view @click.stop="onClick" class="content">
			<text class="text">点击蒙层关闭</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			onClick(e) {
				uni.showToast({
					title: "点击蒙层关闭"
				})
				// #ifdef APP-NVUE
				e.stopPropagation()
				// #endif
			},
			close() {
				uni.navigateBack()
			}
		}
	}
</script>

<style>
	page {
		background: transparent;
	}

	.mask {
		position: fixed;
		left: 0;
		top: 0;
		right: 0;
		bottom: 0;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		justify-content: center;
		align-items: center;
		background-color: rgba(0, 0, 0, 0.4);
	}

	.content {
		width: 200px;
		height: 200px;
		background-color: #007AFF;
	}

	.text {
		/* #ifndef APP-NVUE */
		display: block;
		/* #endif */
		line-height: 200px;
		text-align: center;
		color: #FFFFFF;
	}
</style>

manifest.json 配置

复制代码
	{
		"path": "pages/popup/popup",
		"style": {
			"navigationStyle": "custom",
			"backgroundColor": "transparent",
			"app-plus": {
				"animationType": "fade-in",
				"background": "transparent",
				"popGesture": "none"
			}
		}
	}

预期效果

相关推荐
风骏时光牛马2 分钟前
AIRAG服务异常监控告警
前端
大厂码农老A6 分钟前
汤森路透的座上宾?Qwen3.5-397B-A17B到底有什么本事?
前端·人工智能·后端
静开13 分钟前
Skills和MCP 到底什么区别
前端·人工智能
伯远医学19 分钟前
RIP-seq 高分文献案例分享
java·前端·javascript·人工智能·算法·eclipse·html
hunterandroid19 分钟前
[鸿蒙从零到一] LazyForEach 复用陷阱与 KeyGenerator 设计实战
前端
Hilaku25 分钟前
Web Components 为什么火不起来?
前端·javascript·程序员
Liora_Yvonne30 分钟前
从数据库到 Vue 页面:用 LY Fullstack 完成第一个真实全栈业务模块
前端·后端·nestjs
hunterandroid36 分钟前
自定义 View 绘制与触摸冲突:从滑动卡顿到事件分发闭环
android·前端
vancece40 分钟前
JS实现堆 & 215.数组中的第K个最大元素
java·前端·javascript
lichenyang4531 小时前
NestJS + Socket.IO 鉴权、用户房间与幂等邀请
前端·后端