Skip to content

List

A basic data container that uniformly handles plain lists, loading states, empty states, error states, completed states, grouping, and list item slots. For large data scenarios, use SeeVirtualList.

Platform Differences

App (vue)App (nvue)H5Mini Program

Basic Usage

  • Pass data list via list.
  • Customize list item content via the item slot.
html
<see-list :list="['Apple', 'Banana', 'Orange']">
  <template #item="{ item }">
    <view style="padding: 20rpx;">{{ item }}</view>
  </template>
</see-list>

Loading State

  • Set loading to true to show the loading state.
  • Customize loading text via loadingText.
html
<see-list :list="[]" loading />
<see-list :list="[]" loading loadingText="Loading..." />

Empty State

  • When list is empty and not loading or in error state, the empty state is shown automatically.
  • Customize empty state text via emptyText.
html
<see-list :list="[]" emptyText="No orders" />

Error State

  • Set error to true to show the error state.
  • Customize error text via errorText.
  • Clicking the error state triggers the onRetry event.
html
<see-list :list="[]" error errorText="Network error, tap to retry" />

Load More

  • Set finished to true to show "No more data" prompt.
  • Customize finished text via finishedText.
  • Scrolling to the bottom automatically triggers the onLoadMore event.
html
<see-list
  :list="list"
  :loading="loading"
  :finished="finished"
  @onLoadMore="loadMore"
>
  <template #item="{ item }">
    <view style="padding: 20rpx;">{{ item }}</view>
  </template>
</see-list>

Dividers and Borders

  • Set divided to true to show dividers.
  • Set border to true to show borders.
html
<see-list :list="list" divided>
  <template #item="{ item }">
    <view style="padding: 20rpx;">{{ item }}</view>
  </template>
</see-list>

<see-list :list="list" border>
  <template #item="{ item }">
    <view style="padding: 20rpx;">{{ item }}</view>
  </template>
</see-list>

Horizontal Scrolling

  • Set direction to horizontal for a horizontal list.
html
<see-list :list="list" direction="horizontal" itemGap="16rpx">
  <template #item="{ item }">
    <view style="width: 200rpx; padding: 20rpx; background: #f5f5f5;">{{ item }}</view>
  </template>
</see-list>

Grouped List

  • Set the grouping field name or grouping function via groupBy.
html
<!-- Group by field -->
<see-list :list="list" groupBy="category">
  <template #group="{ group, count }">
    <view style="padding: 16rpx 24rpx; background: #f5f5f5;">
      {{ group }} ({{ count }})
    </view>
  </template>
  <template #item="{ item }">
    <view style="padding: 20rpx;">{{ item.name }}</view>
  </template>
</see-list>

<!-- Custom grouping function -->
<see-list :list="list" :groupBy="(item) => item.age > 18 ? 'Adult' : 'Minor'">
  <template #group="{ group }">
    <view style="padding: 16rpx 24rpx; background: #f5f5f5;">{{ group }}</view>
  </template>
  <template #item="{ item }">
    <view style="padding: 20rpx;">{{ item.name }}</view>
  </template>
</see-list>

Slot Usage

  • header: List header slot.
  • footer: List footer slot.
  • item: List item slot, exposes item and index.
  • loading: Custom loading state.
  • empty: Custom empty state.
  • error: Custom error state.
  • finished: Custom finished state.
html
<see-list :list="list">
  <template #header>
    <view style="padding: 20rpx; font-weight: bold;">List Title</view>
  </template>
  <template #item="{ item, index }">
    <view style="padding: 20rpx;">{{ index }}. {{ item }}</view>
  </template>
  <template #footer>
    <view style="padding: 20rpx; text-align: center;">— End —</view>
  </template>
</see-list>

Custom Styling

  • Set list item gap via itemGap.
  • Set padding via padding.
html
<see-list :list="list" itemGap="16rpx" padding="24rpx">
  <template #item="{ item }">
    <view style="padding: 20rpx; background: #f5f5f5; border-radius: 8rpx;">{{ item }}</view>
  </template>
</see-list>

API

Props

ParameterDescriptionTypeDefaultOptional ValuesPlatform Notes
listData listArray[]Any array-
keyFieldUnique identifier field nameString''Any string-
loadingWhether loadingBooleanfalsetrue, false-
finishedWhether all data is loadedBooleanfalsetrue, false-
errorWhether loading error occurredBooleanfalsetrue, false-
emptyTextEmpty state textString''Any string-
errorTextError state textString''Any string-
loadingTextLoading textString''Any string-
finishedTextFinished textString''Any string-
immediateCheckWhether to check load more immediately (auto-trigger when content is less than one screen)Booleantruetrue, false-
offsetDistance threshold to trigger load more (px)Number50Any positive number-
directionList direction'vertical' | 'horizontal''vertical'vertical, horizontal-
borderWhether to show borderBooleanfalsetrue, false-
dividedWhether to show dividersBooleanfalsetrue, false-
itemGapList item gapString''Any CSS length value-
paddingPaddingString''Any CSS length value-
groupByGrouping field name or functionString / FunctionundefinedString or (item, index) => string-

Events

EventDescriptionCallback ParametersPlatform Notes
onLoadMoreTriggered when scrolling to bottomNone-
onRefreshTriggered when scrolling to topNone-
onRetryTriggered when error state is tappedNone-
onClickItemTriggered when list item is tappeditem: unknown, index: number-

Slots

Slot NameDescriptionScope Data
headerList headerNone
footerList footerNone
itemList item content{ item, index } or { item, index, group } (when grouped)
groupGroup title{ group, count }
loadingCustom loading stateNone
emptyCustom empty stateNone
errorCustom error stateNone
finishedCustom finished stateNone

Liao ICP No. 2025070134