Skip to content

mms-bottom-popup 底部弹窗

简述

底部弹窗,从底部弹出内容,支持遮罩层,适配安全区域。

注意

注意: 请以 uni_modules/mms-unix 与本文为准;各端差异以 uni-app 与各平台官方文档为准。涉及隐私能力(相册、定位、剪贴板、手机号等)需在 manifest 与后台完成配置。

平台差异说明

App(vue)App(nvue)H5小程序

效果

  • 从底部向上弹出内容
  • 点击蒙层关闭
  • 适配 iPhone 底部安全区域
  • 阻止遮罩下层滚动穿透

基本使用

uvue
<template>
	<view>
		<mms-bottom-popup
			:show="showPopup"
			:height="600"
			:radius="true"
			@close="showPopup = false"
		>
			<view>
				<!-- 弹窗内容 -->
				<text>这里是弹窗内容</text>
			</view>
		</mms-bottom-popup>
	</view>
</template>

<script setup lang="uts">
	const showPopup = ref(false)
</script>

Props

参数说明类型默认值
show是否显示弹窗booleanfalse
mask是否显示遮罩蒙层booleantrue
backgroundColor弹窗背景颜色string#fff
height弹窗高度,单位 rpxnumber0 (auto)
radius是否显示顶部圆角booleantrue
zIndex弹窗z-index层级number997
maskZIndex蒙层z-index层级number996
translateY弹窗垂直偏移string0
isSafeArea是否适配底部安全区域booleantrue

Events

事件名说明回调参数
close点击蒙层关闭时触发-

插槽

名称说明
default弹窗内容

示例

基础用法

uvue
<mms-bottom-popup
	:show="show"
	height="800"
	@close="show = false"
>
	<view>
		<view class="content">
			<text>这是底部弹窗内容</text>
		</view>
	</view>
</mms-bottom-popup>

自定义高度

uvue
<mms-bottom-popup
	:show="show"
	height="400"
	@close="show = false"
>

不显示圆角

uvue
<mms-bottom-popup
	:show="show"
	:radius="false"
	@close="show = false"
>

注意事项

  1. 默认已经阻止了蒙层下方的滚动穿透,不需要额外处理
  2. 安全区域适配默认开启,如果不需要可以关闭

Released under the MIT License.