Skip to content

ListView Component

ListView Component

ListView component is used to display large amounts of data, supporting virtual scrolling, fixed rows, and custom layouts.

Basic Usage

Basic list view for displaying a set of data.

Show CodeArrow
CopyGitHub

Empty Data Display

When list data is empty, an empty state prompt will be displayed.

Show CodeArrow
CopyGitHub

Virtual Scrolling

When displaying large amounts of data, virtual scrolling can be enabled to improve performance.

Total data: 10000 items
Event Log:
Show CodeArrow
CopyGitHub

Fixed Items

Through the itemFixed attribute, you can set specific items to be fixed and not move with scrolling.

Show CodeArrow
CopyGitHub

List Slots

ListView provides header and footer slots for adding additional content.

Show CodeArrow
CopyGitHub

ListView Component API

Attributes

AttributeDescriptionTypeAccepted ValuesDefault
listDataList data sourcearray[]
heightList container heightnumber
isVirtualizedWhether to enable virtual scrollingbooleanfalse
itemHeightFixed height for virtual list itemsnumber
itemFixedFixed item judgment functionfunction(index, row)
emptyTextEmpty data prompt textstringNo data

Events

Event NameDescriptionCallback Parameters
scrollTriggered when list scrolls(element: HTMLElement)
update-viewTriggered when view updates(element: HTMLElement)

Slots

Slot NameDescriptionScope Parameters
defaultList item content{ row: any, index: number }
headList header content
footerList footer content
emptyEmpty state content

Style Variables

ListView component uses the following style variables, which can be customized through SCSS variables:

Variable NameDescription
$border-color-defaultDefault border color
$z-index-dropdownDropdown z-index
$bg-color-overlayOverlay background color

Released under the MIT License