Popup
Popup (팝업)
팝업 레이어 컨테이너예요. 팝업 창이나 정보 알림 같은 콘텐츠를 띄우는 데 사용하고, 여러 팝업 레이어를 겹쳐서 표시하는 것도 지원해요.
출처: 문서
본문
소개 (Intro)
팝업 레이어 컨테이너로, 팝업 창·정보 알림 등의 콘텐츠를 표시하는 데 사용되고 여러 팝업 레이어의 겹쳐 표시를 지원해요.
설치 (Install)
import { createApp } from 'vue'
import { Popup } from '@nutui/nutui'
const app = createApp()
app.use(Popup)
기본 사용법 (Basic Usage)
visible로 표시/숨김을 제어해요.
demo: popup basic
위치 (Position)
position 값으로 팝업 위치를 제어해요.
demo: popup position
닫기 아이콘 (Close Icon)
closeable로 닫기 아이콘을 표시할지 제어하고, close-icon-position으로 아이콘 위치를 정하고, close-icon으로 표시할 아이콘을 정해요.
demo: popup close
둥근 모서리 (Round)
round를 설정해 둥근 모서리를 표시할지 제어해요.
demo: popup round
다중 레이어 (Multi Layers)
demo: popup multi
Teleport
Vue가 제공하는 Teleport 컴포넌트를 사용해 지정한 노드에 마운트할 수 있어요.
demo: popup port
API
Props
| Attribute | Description | Type | Default |
|---|---|---|---|
| v-model:visible | Control the display/hide of the current component | boolean | false |
| z-index | Mask level | string | number | 2000 |
| duration | Animation duration of component display/hide, in seconds | string | number | 0.3 |
| lock-scroll | Whether the background is locked | boolean | true |
| overlay | Show mask | boolean | true |
| close-on-click-overlay | Click to close the mask | boolean | true |
| position | Eject position(top,bottom,left,right,center) | string | "center" |
| transition | Animation name | string | - |
| style | Custom pop-up style | CSSProperties | - |
| pop-class | Custom bullet box classname | string | - |
| closeable | Show close button | boolean | false |
| close-icon-position | Close button position(top-left,top-right,bottom-left,bottom-right) | string | "top-right" |
| destroy-on-close | Will the contents of slot be cleared after the bullet layer is closed |
boolean | true |
| round | Show fillet | boolean | false |
| overlay-class | Custom mask class name | string | - |
| overlay-style | Custom Mask Style | CSSProperties | - |
| safe-area-inset-bottom | Whether to enable iPhone series full screen bottom safety zone adaptation, which is only valid when position is bottom |
Boolean | false |
| teleport | Specify the mount node | string | "body" |
| teleport-disable | Whether the node is allowed to be mounted, true means mount | boolean | false |
Events
| Event | Description | Arguments |
|---|---|---|
| click-pop | Triggered when clicking the pop-up layer | event: Event |
| click-close-icon | Triggered when the close icon is clicked | event: Event |
| open | Triggered when the pop-up box is opened | - |
| close | Triggered when the pop-up box is closed | - |
| opened | Triggered at the end of the mask open animation | el: Element |
| closed | Triggered when the mask closes and the animation ends | el: Element |
| click-overlay | Click mask trigger | event: Event |
Slots
| Name | Description |
|---|---|
| default | Customize Embedded Content |
| close-icon | Custom icon for close button |
Theming
CSS Variables
The component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.
| Name | Default Value |
|---|---|
| --nut-popup-close-icon-margin | 16px |
| --nut-popup-border-radius | 20px |
더 알아보기 (Learn more)
- 원문 문서: Popup — NutUI v4 영문 문서
- NutUI 저장소: jd-opensource/nutui