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

预期效果

相关推荐
爱分享的程序猿-Clark13 分钟前
【前端分享】CSS实现3种翻页效果类型,附源码!
前端·css
Code哈哈笑28 分钟前
【图书管理系统】深度讲解:图书列表展示的后端实现、高内聚低耦合的应用、前端代码讲解
java·前端·数据库·spring boot·后端
无名之逆1 小时前
Hyperlane: Unleash the Power of Rust for High-Performance Web Services
java·开发语言·前端·后端·http·rust·web
数据潜水员1 小时前
`待办事项css样式
前端·css·css3
_处女座程序员的日常1 小时前
css媒体查询及css变量
前端·css·媒体
GanGuaGua3 小时前
CSS:盒子模型
开发语言·前端·css·html
七七小报4 小时前
uniapp-商城-47-后台 分类数据的生成(通过数据)
uni-app
星空寻流年8 小时前
css3伸缩盒模型第二章(侧轴相关)
javascript·css·css3
GalenWu9 小时前
对象转换为 JSON 字符串(或反向解析)
前端·javascript·微信小程序·json
GUIQU.9 小时前
【Vue】微前端架构与Vue(qiankun、Micro-App)
前端·vue.js·架构