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

预期效果

相关推荐
IT、木易12 分钟前
大白话 CSS 中transform属性的常见变换类型(平移、旋转、缩放等)及使用场景
前端·css·面试
1024小神32 分钟前
更改github action工作流的权限
前端·javascript
Epicurus36 分钟前
JavaScript无阻塞加载的方式
前端·javascript
1024小神39 分钟前
tauri程序使用github action发布linux中arm架构
前端·javascript
ahhdfjfdf41 分钟前
最全的`Map` 和 `WeakMap`的区别
前端
JYeontu1 小时前
实现一个带@功能的输入框组件
前端·javascript·vue.js
一颗奇趣蛋1 小时前
vue-router的query和params的区别(附实际用法)
前端·vue.js
孤城2861 小时前
MAC电脑常用操作
前端·macos·快捷键·新手·电脑使用
木亦Sam1 小时前
Vue DevTools逆向工程:自己实现一个组件热更新调试器
前端
酷酷的阿云1 小时前
动画与过渡效果:UnoCSS内置动画库的实战应用
前端·css·typescript