# Conversations
# Features
A component for displaying and managing multiple conversation sessions, with the following features:
- Display conversation list with scroll loading
- Grouped display with sticky headers
- Built-in and custom dropdown menus
- Custom item and container styles
- "Load more" and "back to top" functionality
- Custom grouping and item content
# Usage Examples
# Basic Usage
Basic usage of the conversation list component, displaying a simple list of conversations with selection.
# Grouping with Sticky Headers
When grouping is enabled, the group titles will automatically become sticky during scrolling.
# Custom Group Sorting
You can control the order of groups with a custom sort function, for example, by alphabetical order or other logic.
# Built-in Dropdown Menu
With the built-in menu enabled, hovering over an item will display an action menu. Clicking a menu item triggers the corresponding action.
# Custom Menu Interaction
You can customize the icon, text, and style of menu items, and handle menu command events.
# Load More Functionality
Automatically load more items when scrolling to the bottom, with support for a "back to top" button.
Button Style:
# Custom Styles and Group Titles
You can customize item styles, container styles, and use slots to customize group titles and item content.
# Attributes
Attribute | Description | Type | Default |
---|---|---|---|
items | Conversation list data | Array | [] |
itemsStyle | Custom style for items | Object | {} |
itemsHoverStyle | Hover style for items | Object | {} |
itemsActiveStyle | Style for active items | Object | {} |
itemsMenuOpenedStyle | Style for items when the menu is open | Object | {} |
styleConfig | Container style configuration | Object | { padding: '10px 0 10px 10px', backgroundColor: '#fff', borderRadius: '8px', width: '280px', height: '0' } |
showTooltip | Whether to show a tooltip | Boolean | false |
groupable | Whether to enable grouping, can pass a sort function | Boolean/Object | false |
labelMaxWidth | Maximum width for the label | Number | undefined |
labelHeight | Height of the label | Number | 20 |
showBuiltInMenu | Whether to show the built-in menu | Boolean | false |
menu | Custom menu item configuration | Array | [{ label: 'Rename', key: 'rename', icon: 'el-icon-edit', command: 'rename' }, { label: 'Delete', key: 'delete', icon: 'el-icon-delete', command: 'delete', menuItemHoverStyle: { color: 'red', backgroundColor: 'rgba(255, 0, 0, 0.1)' } }] |
ungroupedTitle | Title for ungrouped items | String | 'Ungrouped' |
tooltipPlacement | Tooltip position | String | 'top' |
tooltipOffset | Tooltip offset | Number | 12 |
menuPlacement | Menu position | String | 'bottom-start' |
menuShowArrow | Whether the menu shows an arrow | Boolean | false |
menuStyle | Custom style for the menu | Object | {} |
loadMoreLoading | Loading state for "load more" | Boolean | false |
showToTopBtn | Whether to show the "back to top" button | Boolean | false |
toTopBtnType | Type of the "back to top" button | String | 'primary' |
toTopBtnStyle | Custom style for the "back to top" button | Object | {} |
labelKey | Field name for the item label | String | 'label' |
rowKey | Field name for the unique key of the item | String | 'id' |
active | Currently active item | String/Number/Boolean | '' |
loadMore | Function to load more items | Function | null |
# Methods
Method Name | Description | Parameters | Return Value |
---|---|---|---|
scrollToTop | Scrolls to top | - | - |
# Events
Event Name | Description | Callback Parameters |
---|---|---|
change | On selection change | The selected item object |
menuCommand | On menu command | (command, item): command name and item object |
# Slots
Slot Name | Description | Scope Parameters |
---|---|---|
header | Content at the top of the list | - |
footer | Content at the bottom of the list | - |
group-title | Group title | { group: group object } |
label | Item label content | { item: item object } |
menu | Custom menu content | { item: item object } |
more-filled | More icon content | Menu related attributes |
load-more | Load more content | - |