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"
			}
		}
	}

预期效果

相关推荐
ClouGence4 小时前
零代码自动化测试:手把手教你录出一条能反复用的测试用例
前端·测试
skiyee4 小时前
🔥UniApp 仅需 5 行代码!实现所有页面中控制应用主题变化
前端·微信小程序
LaiYoung_4 小时前
🎁 送你一套超好用超实用的 FE AI-Coding Skills
前端·人工智能·开源
幼儿园技术家4 小时前
实现 GEO 监控:从多引擎探测到优化闭环
前端·后端
甲维斯4 小时前
GLM5.2+ZCode复刻坦克大战,自测50万帧!
前端·ai编程·游戏开发
Csvn5 小时前
useRef 的 5 个冷门但救命的高级用法
前端
小小小小宇5 小时前
Harness Engineering 与 AI 联动
前端
鱼人5 小时前
HTML5 页面性能优化大全
前端
ping某5 小时前
专栏-null 和 undefined 到底是什么?
前端·javascript·后端
用户900463370406 小时前
5MB vs 4KB vs 无限大:浏览器存储谁更强?
前端