A popup component for modifying match scores, used by referees or administrators to adjust team scores with support for dual team score adjustment and both teams lose functionality.
Features
- π― Score Adjustment - Support increasing/decreasing both team scores, range 0-999
- π₯ Dual Team Display - Clearly display two team information and current scores
- βοΈ Both Teams Lose - One-click both teams lose functionality
- π¨ Custom Styles - Rich CSS variables for theme customization
- π§ Slot Support - Support custom confirm button and both lose button slots
- π Data Validation - Automatically limit score range, prevent abnormal input
- β‘ Lightweight & Efficient - Optimized code structure with excellent performance
Use Cases
- E-sports match score correction
- Sports event score adjustment
- Online game battle result modification
- Match management system
Import
Code Demo
Basic Usage
Custom Slots Usage
Custom Styles
API
Props
| Attribute | Description | Type | Default |
| custom-class | Custom CSS class | string | '' |
| z-index | PopupPlus z-index | number | 100 |
| title | PopupPlus title | string | 'ζΉε€ζ―ε' |
| show | Whether to show popup | boolean | false |
| left-team | Left team information | TeamInfo | { name: 'ζιεη§°A' } |
| right-team | Right team information | TeamInfo | { name: 'ζιεη§°A' } |
| initial-left-score | Initial left team score | number | 0 |
| initial-right-score | Initial right team score | number | 5 |
| slot-confirm-btn | Whether to use confirm btn slot | boolean | false |
| slot-both-lose-btn | Whether to use both lose slot | boolean | false |
TeamInfo Data Structure
Events
| Event | Description | Parameters |
| close | Triggered when popup is closed | - |
| confirm | Triggered when score is confirmed | leftScore: number, rightScore: number |
| both-lose | Triggered when both teams lose | leftScore: number, rightScore: number |
Slots
| Slot Name | Description | Parameters |
| confirm-btn | Custom confirm button | - |
| bothLoseBtn | Custom both lose button | - |
Slot Usage Notes:
- The
confirm-btn slot replaces the default confirm button, you need to handle click events yourself - The
bothLoseBtn slot replaces the default both lose button, you need to handle click events yourself - Slot content completely replaces the default buttons, please ensure proper interactive elements are provided
Notes
Usage Recommendations
- Score Range: Component automatically limits score range to 0-999, values outside range will be adjusted automatically
- Team Avatars: It is recommended to set default placeholder images for team avatars to avoid blank display when loading fails
- Popup Z-Index: When using in complex pages, pay attention to adjusting
z-index to avoid layer conflicts - Event Handling: Ensure proper handling of
confirm and both-lose events to update business data - Slot Usage: When using custom slots, slot content completely replaces default buttons, please ensure you handle click events yourself
- Responsive Adaptation: On small screen devices, it's recommended to appropriately adjust related size variables
- Use
v-show to control popup display, avoid frequent creation and destruction - Reasonably use
computed to optimize data calculation - Avoid complex data processing inside the popup
Compatibility
- Support Vue 3.0+
- Compatible with modern browsers (Chrome 60+, Firefox 60+, Safari 12+)
- Support WeChat Mini Program, Alipay Mini Program and other platforms
Theme Customization
CSS Variables
The component provides the following CSS variables, which can be used to customize styles. For usage, please refer to ConfigProvider component.
Size Properties (Width/Height)
| Name | Default Value | Description |
| --csp-head-confirm-width | 1.4rem | Confirm button width |
| --csp-head-confirm-height | .56rem | Confirm button height |
| --csp-content-team-min-height | 1.12rem | Team content min height |
| --csp-team-info-avatar-size | .8rem | Team avatar size |
| --csp-content-team-score-width | 2rem | Score area width |
| --csp-content-team-score-height | .44rem | Score area height |
| --csp-score-number-width | 1.14rem | Score number width |
| --csp-score-number-height | .44rem | Score number height |
| --csp-score-btn-size | .44rem | Score button size |
| --csp-score-btn-sub-width | .272rem | Decrease button width |
| --csp-score-btn-sub-height | .04rem | Decrease button height |
| --csp-warning-height | .96rem | Warning area height |
Spacing Properties (Margin/Padding/Gap)
| Name | Default Value | Description |
| --csp-popup-head-padding-top | $spacing-md | PopupPlus head top padding |
| --csp-popup-head-margin-bottom | $spacing-lg | PopupPlus head bottom margin |
| --csp-content-team-padding | .32rem 0 .16rem | Team content padding |
| --csp-popup-content-margin-bottom | .4rem | PopupPlus content bottom margin |
| --csp-team-info-avatar-margin-right | $spacing-sm | Team avatar right margin |
| --csp-content-team-score-margin | auto 0 | Score area margin |
| --csp-content-team-score-gap | 0 | Score area gap |
| --csp-warning-padding-bottom | .28rem | Warning area bottom padding |
| --csp-warning-gap | $spacing-xs | Warning area gap |
Color Properties (Color/Background)
| Name | Default Value | Description |
| --csp-popup-bg | $color-surface-default | PopupPlus background color |
| --csp-score-btn-bg | $color-icon-dark | Score button background |
| --csp-score-btn-disabled-bg | $color-surface-secondary | Disabled button background |
| --csp-score-btn-sub-bg | $color-text-primary | Decrease button background |
| --csp-score-number-bg | rgba(247, 249, 250, 1) | Score number background |
| --csp-score-btn-color | $color-text-invert-light | Score button text color |
| --csp-score-number-color | $color-text-primary | Score number color |
| --csp-team-info-name-color | $color-text-primary | Team name color |
| --csp-warning-icon-color | $color-icon-dark | Warning icon color |
| --csp-warning-text-color | $color-text-primary | Warning text color |
Font Properties (Font)
| Name | Default Value | Description |
| --csp-head-confirm-font-size | $font-size-sm | Confirm button font size |
| --csp-team-info-name-font-size | $font-size-lg | Team name font size |
| --csp-score-number-font-size | $font-size-md | Score number font size |
| --csp-score-number-font-weight | $font-weight-bold | Score number font weight |
| --csp-score-btn-icon-font-size | .38rem | Score button icon size |
| --csp-warning-text-font-size | .32rem | Warning text font size |
| --csp-warning-icon-font-size | $font-size-xl | Warning icon font size |
Border Properties (Border/Border-Radius)
| Name | Default Value | Description |
| --csp-content-team-border-bottom | .02rem solid #eaeff2 | Team content bottom border |
| --csp-team-info-avatar-border-radius | $border-radius-circle | Team avatar border radius |
| --csp-score-btn-sub-border-radius | $border-radius-xs | Decrease button border radius |
Position Properties (Position/Top/Left/Z-Index)
| Name | Default Value | Description |
| --csp-popup-position | relative | PopupPlus position |
| --csp-popup-head-position | relative | PopupPlus head position |
Layout Properties (Flex)
| Name | Default Value | Description |
| --csp-team-info-flex | 1 | Team info flex value |
| --csp-score-btn-flex-shrink | 0 | Score button flex shrink |
Other Properties (Others)
| Name | Default Value | Description |
| --csp-team-info-avatar-object-fit | cover | Team avatar object fit |