A universal popup component based on PressPopup, supporting customizable content in header, body, and footer areas.
Import
Usage
Basic Usage
Advanced Usage
Conditional Rendering
The component automatically decides whether to render corresponding areas based on slot content:
head-right area is rendered only when the slot has content foot-content area is rendered only when the slot has content body-content slot is the required content area
API
Props
| Attribute | Description | Type | Default |
| show | Whether to show popup, supports v-model | boolean | false |
| title | PopupPlus title | string | '温馨提示' |
| isRound | Whether to show rounded corners | boolean | true |
| zIndex | PopupPlus z-index | number | 100 |
| customClass | Custom class name | string | '' |
Events
| Event | Description | Arguments |
| close | Triggered when popup is closed | reason?: string - Close reason |
| update:show | Triggered when popup visibility changes, supports v-model | value: boolean - Visibility state |
Slots
| Name | Description | SlotProps |
| head-right | Header right content, rendered only when has content | - |
| body-content | PopupPlus main content | - |
| foot-content | Footer content, rendered only when has content | - |
CSS Variables
The component provides the following CSS variables for customization:
Spacing System
| CSS Variable | Description | Default Value |
| --pmpopup-foot-padding-tb | Footer top/bottom padding | $spacing-lg |
| --pmpopup-foot-padding-lr | Footer left/right padding | .76rem |
| --pmpopup-close-offset-left | Close button left offset | $spacing-lg |
| --pmpopup-right-content-offset | Right content offset | $spacing-lg |
Size System
| CSS Variable | Description | Default Value |
| --pmpopup-head-height | DialogPlus header height | 1.12rem |
| --pmpopup-close-size | Close button size | .4rem |
Color System
| CSS Variable | Description | Default Value |
| --pmpopup-head-bg-color | DialogPlus header background color | none |
| --pmpopup-head-text-color | DialogPlus header text color | $color-text-primary |
| --pmpopup-close-icon-color | Close button icon color | $color-text-primary |
| --pmpopup-bg-color | DialogPlus background color | #fff |
| --pmpopup-foot-bg-color | DialogPlus footer background color | none |
Font System
| CSS Variable | Description | Default Value |
| --pmpopup-head-font-size | DialogPlus header font size | $font-size-lg |
| --pmpopup-head-font-weight | Header font weight | $font-weight-bold |
Usage Example
Notes
- Two-way Binding: Supports
v-model:show syntax sugar - Event Passing: Triggers
close event with close reason when closing - Conditional Rendering: Header right and footer areas are rendered only when slots have content
- Mini Program Compatibility: Supports WeChat mini program's
virtualHost and styleIsolation configuration
Dependencies
PressPopup: Base popup component