import{c as t,o as d,A as o}from"./vendor.80bf15c7.js";const e={class:"markdown-body"},n=o('

Popup 弹出层 组件

介绍

弹出层容器,用于展示弹窗、信息提示等内容,支持多个弹出层叠加展示

安装

import { createApp } from 'vue';\nimport { Popup } from '@nutui/nutui';\n\nconst app = createApp();\napp.use(Popup);\n

代码演示

基础用法

show 控制显示/隐藏

<nut-popup :style="{ padding: '30px' }" v-model:show="show">正文</nut-popup>\n

弹出位置

<nut-popup\n  position="top"\n  v-model:show="show"\n  :style="{ height: '20% }"\n></nut-popup>\n\n<nut-popup\n  position="left"\n  v-model:show="show"\n  :style="{ height: '100%', width: '20%' }"\n></nut-popup>\n

图标

<nut-popup\n  position="bottom"\n  closeable\n  :style="{ height: '20%' }"\n  v-model:show="show"\n></nut-popup>\n\n<nut-popup\n  position="bottom"\n  closeable\n  close-icon-position="top-left"\n  :style="{ height: '20%' }"\n  v-model:show="show"\n></nut-popup>\n\n<nut-popup\n  position="bottom"\n  closeable\n  close-icon-position="top-left"\n  close-icon="heart"\n  :style="{ height: '20%' }"\n  v-model:show="show"\n></nut-popup>\n

圆角弹框

<nut-popup\n  position="bottom"\n  closeable\n  round\n  :style="{ height: '30%' }"\n  v-model:show="show"\n></nut-popup>\n

指定挂载节点

<nut-popup :style="{ padding: '30px' }" teleport="#app" v-model:show="show">app</nut-popup\n

API

Props

参数说明类型默认值
show当前组件是否显示Booleanfalse
z-index遮罩层级String、Number2000
duration动画时长,单位秒String、Number0.3
overlay-class自定义遮罩类名String-
overlay-style自定义遮罩样式CSSProperties-
lock-scroll背景是否锁定Booleanfalse
overlay是否显示遮罩Booleantrue
close-on-click-overlay是否点击遮罩关闭Booleantrue
position弹出位置(top,bottom,left,right,center)String“center”
transition动画名String-
style自定义弹框样式CSSProperties-
pop-class自定义弹框类名String-
closeable是否显示关闭按钮Booleantrue
close-icon-position关闭按钮位置(top-left,top-right,bottom-left,bottom-right)String“top-right”
close-icon自定义 IconString“close”
destroy-on-close组件销毁后是否关闭Booleantrue
round是否显示圆角Booleanfalse
teleport指定挂载节点String“body”

Events

事件名说明回调参数
click点击弹框时触发event: Event
click-close-icon点击关闭图标时触发event: Event
open打开弹框时触发-
close关闭弹框时触发-
opend遮罩打开动画结束时触发event: Event
closed遮罩关闭动画结束时触发event: Event
click-overlay点击遮罩触发event: Event
',22),p={expose:[],setup:o=>(o,p)=>(d(),t("div",e,[n]))};export default p;