# BubbleList Message List Component
# Features
Message list component for displaying a group of conversation messages, supporting the following features:
- Auto scroll to latest message
- Back to bottom button
- Unified bubble style settings
- Custom scroll control
- Custom avatar and content rendering
# Usage Examples
# Basic Usage
Basic usage of the message list component to display multiple messages.
Copy
# Global Default Configuration(Can be used in the scene of displaying historical message records, unified setting)
Unify the style of all bubbles through default*
prefix attributes, with higher priority than settings within the Bubble component.
Copy
# Typewriter Effect and Auto Scroll
Demonstrate typewriter effect and auto scroll to latest message functionality.
Copy
# Back to Bottom Button
When scrolled to the top, a back to bottom button is displayed.
Copy
# Custom Slots
Use slots to customize bubble avatar and content.
Copy
# Loading State and Complex Messages
Display loading states and different types of message content.
Copy
# Attributes
Parameter | Description | Type | Default |
---|---|---|---|
list | Bubble list data | Array | [] |
maxHeight | Maximum height of the list | String | '500px' |
triggerIndices | Indices that trigger bubble completion event, options: 'only-last'/'all'/Array | String/Array | 'only-last' |
alwaysShowScrollbar | Whether to always show scrollbar | Boolean | false |
backButtonThreshold | Scroll threshold for showing back to bottom button | Number | 80 |
showBackButton | Whether to show back to bottom button | Boolean | true |
backButtonPosition | Position of back to bottom button | Object | { bottom: '20px', left: 'calc(50% - 19px)' } |
btnLoading | Whether button shows loading animation | Boolean | true |
btnColor | Button color | String | '#409EFF' |
btnIconSize | Button icon size | Number | 24 |
defaultPlacement | Default bubble placement, higher priority than bubble component | String | '' |
defaultLoading | Default loading state, higher priority than bubble component | Boolean | undefined |
defaultShape | Default bubble shape, higher priority than bubble component | String | '' |
defaultVariant | Default bubble variant, higher priority than bubble component | String | '' |
defaultIsMarkdown | Default whether to parse Markdown, higher priority than bubble component | Boolean | true |
defaultIsFog | Default whether to enable fog effect, higher priority than bubble component | Boolean | false |
defaultTyping | Default typing effect config, higher priority than bubble component | Boolean/Object | undefined |
defaultMaxWidth | Default bubble max width, higher priority than bubble component | String | '' |
defaultAvatar | Default avatar URL, higher priority than bubble component | String | '' |
defaultAvatarSize | Default avatar size, higher priority than bubble component | Number | undefined |
defaultAvatarGap | Default avatar gap, higher priority than bubble component | Number | undefined |
defaultAvatarShape | Default avatar shape, higher priority than bubble component | String | '' |
defaultAvatarIcon | Default avatar icon, higher priority than bubble component | String | '' |
defaultAvatarSrcSet | Default avatar srcset, higher priority than bubble component | String | '' |
defaultAvatarAlt | Default avatar alt, higher priority than bubble component | String | '' |
defaultAvatarFit | Default avatar fit mode, higher priority than bubble component | String | '' |
defaultNoStyle | Default whether to remove styles, higher priority than bubble component | Boolean | undefined |
# Methods
Method | Description | Parameters |
---|---|---|
scrollToBottom | Scroll to bottom | — |
scrollToTop | Scroll to top | — |
scrollToIndex | Scroll to message at specified index | index: message index |
# Events
Event | Description | Callback Parameters |
---|---|---|
scroll | Triggered when scrolling | event: scroll event object |
typing-complete | Triggered when a message typing is completed | instance: bubble instance, index: message index |
back-to-bottom-click | Triggered when back to bottom button is clicked | — |
# Slots
Slot Name | Description | Parameters |
---|---|---|
default | Custom message content | { item: message object, index: index } |
avatar | Custom avatar | { item: message object, index: index } |
header | Custom header content | { item: message object, index: index } |
footer | Custom footer content | { item: message object, index: index } |
back-to-bottom | Custom back to bottom button | — |