MatchWatchItem
A watch item component used to display match group information and provide watch entry, supports custom button text and slots.
Features
- 🎯 Flexible Configuration - Supports multiple button types and style configurations
- 🎨 Theme Customization - Rich CSS variables for theme customization
- 📱 Responsive Design - Adapt to different screen sizes
- 🔧 Slot Support - Support custom left and right area content
- ⚡ Lightweight & Efficient - Optimized code structure with excellent performance
Use Cases
- E-sports match watch entry
- Game room list
- Online match viewing
- Live room list display
Import
Code Demo
Basic Usage
Different Group Names
Custom Slots
Custom Theme
API
Props
| Parameter | Description | Type | Default |
| watch-info | Watch item information, includes group name, button text, etc. | WatchItemInfo | - |
| custom-class | Custom style class | string | '' |
| button-type | Button type | 'primary' | 'default' | 'info' | 'warning' | 'danger' | 'primary' |
| button-plain | Whether button is plain | boolean | true |
| button-size | Button size | 'normal' | 'large' | 'small' | 'mini' | 'small' |
| button-open-type | WeChat open capability | string | '' |
| button-disabled | Whether button is disabled | boolean | false |
| button-custom-style | Custom button style | object | {} |
WatchItemInfo Data Structure
Slots
| Name | Description |
| left-area | Custom left area content, displays group name by default |
| right-area | Custom right area content, displays watch button by default |
Events
| Event | Description | Parameters |
| click | Triggered when watch button is clicked | watchInfo: WatchItemInfo - Current watch item information |
Notes
Usage Recommendations
- Watch Item Data:
watch-info requires group name (groupName), button text (btnText) and group ID (id) are optional - Button Configuration: Supports multiple button types (primary, info, warning, danger), sizes (normal, large, small, mini), and plain mode
- WeChat Open Capabilities: Use
button-open-type to access WeChat Mini Program open capabilities (e.g., share, get phone number) - Custom Slots: Provides
left-area and right-area slots for complete customization of left and right area content - Responsive Adaptation: On small screen devices, consider adjusting related size variables
- Component uses virtual host to reduce DOM layers
- Styles use CSS variables for easy dynamic theme switching
- Supports custom slots for flexible extension
Compatibility
- Supports Vue 3.0+
- Compatible with modern browsers (Chrome 60+, Firefox 60+, Safari 12+)
- Supports WeChat Mini Program, Alipay Mini Program and other platforms
Theme Customization
The component provides the following CSS variables for custom styling. Please refer to the ConfigProvider component for usage.
Style Variables
Spacing System
| Name | Default | Description |
| --pmwi-watch-item-padding | .28rem .4rem | Watch item padding |
| --pmwi-watch-item-margin-bottom | $spacing-md | Watch item bottom margin |
| --pmwi-group-name-margin-right | $spacing-sm | Group name right margin |
| --pmwi-watch-btn-margin | 0 | Watch button margin |
| --pmwi-watch-btn-padding | 0 .2rem | Watch button padding |
Box Model System
| Name | Default | Description |
| --pmwi-watch-item-box-sizing | border-box | Watch item box sizing |
| --pmwi-watch-item-height | .98rem | Watch item height |
| --pmwi-group-name-flex | 1 | Group name flex value |
| --pmwi-watch-btn-width | 1.28rem | Watch button width |
| --pmwi-watch-btn-height | .5rem | Watch button height |
Border System
| Name | Default | Description |
| --pmwi-watch-item-border-width | 0 | Watch item border width |
| --pmwi-watch-item-border-style | solid | Watch item border style |
| --pmwi-watch-item-border-color | $color-border-brand | Watch item border color |
| --pmwi-watch-item-border-left-width | 0 | Watch item left border width |
| --pmwi-watch-item-border-left-style | solid | Watch item left border style |
| --pmwi-watch-item-border-left-color | $color-border-brand | Watch item left border color |
| --pmwi-watch-item-border-radius | $border-radius-xs | Watch item border radius |
| --pmwi-watch-item-box-shadow | none | Watch item box shadow |
| --pmwi-watch-btn-border-color | $color-border-brand | Watch button border color |
| --pmwi-watch-btn-border-radius | $border-radius-999 | Watch button border radius |
| --pmwi-watch-btn-disabled-border-color | $color-border-tertiary | Watch button disabled border color |
Background System
| Name | Default | Description |
| --pmwi-watch-item-bg | $color-surface-brand-light | Watch item background |
| --pmwi-watch-btn-bg | transparent | Watch button background |
| --pmwi-watch-btn-active-bg | transparent | Watch button active background |
| --pmwi-watch-btn-active-before-bg | transparent | Watch button active before background |
Typography System
| Name | Default | Description |
| --pmwi-group-name-color | $color-text-secondary | Group name text color |
| --pmwi-group-name-font-size | $font-size-md | Group name font size |
| --pmwi-group-name-font-weight | $font-weight-bold | Group name font weight |
| --pmwi-group-name-line-height | 1.5 | Group name line height |
| --pmwi-watch-btn-color | $color-text-brand | Watch button text color |
| --pmwi-watch-btn-font-size | $font-size-sm | Watch button font size |
| --pmwi-watch-btn-font-weight | $font-weight-bold | Watch button font weight |
| --pmwi-watch-btn-line-height | 1.5 | Watch button line height |
| --pmwi-watch-btn-disabled-color | $color-text-invert-dark | Watch button disabled text color |
Others
| Name | Default | Description |
| --pmwi-watch-btn-disabled-opacity | 1 | Watch button disabled opacity |