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

预期效果

相关推荐
时光慢煮4 分钟前
从踩坑到跑通:uni-app 项目落地 HarmonyOS 的完整实录(含模拟器 / 真机)
华为·uni-app·harmonyos
济61710 分钟前
linux 系统移植(第六期)--Uboot移植(5)--bootcmd 和 bootargs 环境变量-- Ubuntu20.04
java·前端·javascript
FFF-X14 分钟前
UniApp 小程序实现自定义每张图片播放时长的轮播图(基于 uView 的 u-swiper)
小程序·uni-app
m0_7482546634 分钟前
AJAX 基础实例
前端·ajax·okhttp
vmiao35 分钟前
【前端入门】商品页放大镜效果(仅放大镜随鼠标移动效果)
前端
i小溪37 分钟前
Easy (Horizontal Scrollbar) Fixes for Your Blog CSS 博客 CSS 的简易(水平滚动条)修复
css
持续前行40 分钟前
vscode 中找settings.json 配置
前端·javascript·vue.js
Anita_Sun41 分钟前
Lodash 源码解读与原理分析 - Lodash IIFE 与兼容性处理详解
前端
用户9047066835743 分钟前
Nuxt 请求后端接口怎么写,一篇文章讲清楚
前端
ahubbub1 小时前
用 maptalks 在 Web 上做可扩展的 2D/3D 地图渲染与交互
前端