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 小时前
当大模型遇上浏览器:用 React + WebGPU 在前端跑通 DeepSeek-R1 的实战笔记
前端·javascript·面试
不好听6133 小时前
Tailwind CSS 原子化 CSS 完全入门:为什么现代前端开发都在用?
前端·css
触底反弹3 小时前
🔥 React 零基础入门(上):环境搭建 + JSX 深度解析
前端·react.js·typescript
why技术3 小时前
分享一套我一直在使用的 AICoding 组合拳,小而美的典范。
前端·后端·ai编程
朦胧之4 小时前
AI应用-消费流式输出
前端·javascript·ai编程
小林ixn4 小时前
在浏览器跑通 15 亿参数大模型:我用 React + WebGPU 复刻了 DeepSeek-R1
前端·react.js·前端框架
Csvn4 小时前
容器查询 @container 实战:告别无休止的媒体查询
前端
稚南城才子,乌衣巷风流6 小时前
函数:编程中的核心概念
开发语言·前端·javascript
IT_陈寒7 小时前
为什么我的JavaScript异步代码总是不按顺序执行?
前端·人工智能·后端
索西引擎7 小时前
【React】useState 状态更新机制:批量更新策略与“异步“错觉的深层解析
前端·react.js·前端框架