List
Infinite scroll list with bottom detection: the state machine (idle → loading → finished / error, error shown first) and class / aria mapping come entirely from @lh-ui/share/core/list; bottom detection is carried by a self-rendered scroll-view (scroll-y + lower-threshold), with the spinner reused for loading.
Platform difference (registered): this end renders its own scroll-view as the scroll carrier (web ends observe the nearest scrollable ancestor); the
heightprop sizes the scroll container; for page-level scrolling, drive the state yourself via the page'sonReachBottom(the component works controlled). Content count is unavailable (the MP runtime cannot enumerate default-slot children), so theemptyTextempty state does not auto-render on this end (use finished + your own lh-empty if needed).
Basic usage
<template>
<lh-list
:loading="loading"
:finished="finished"
:error="error"
:height="260"
empty-text="No orders"
@load="onLoad"
@update:error="error = $event"
>
<view v-for="item in items" :key="item" class="item">Order {{ item }}</view>
</lh-list>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const items = ref<number[]>([])
const loading = ref(false)
const finished = ref(false)
const error = ref(false)
function onLoad() {
loading.value = true
setTimeout(() => {
for (let i = 0; i < 8; i += 1) items.value.push(items.value.length + 1)
loading.value = false
if (items.value.length >= 20) finished.value = true
}, 600)
}
</script>Props
| Prop | Description | Type | Default |
|---|---|---|---|
| loading | Loading (set true before fetching, false after) | boolean | false |
| finished | No more items (footer renders locale text or the finished slot) | boolean | false |
| error | Load failed (footer renders retry entry) | boolean | false |
| offset | Bottom threshold px (scroll-view's lower-threshold) | number | 100 |
| immediateCheck | Check on mount whether content fills the screen (trigger load if not) | boolean | true |
| height | Scroll container height (constrained by the parent when omitted) | number | string | — |
| emptyText | Empty text (not auto-rendered on this end, see platform difference) | string | — |
| ariaLabel | Accessible name | string | — |
| customClass | Custom class (root node) | string | — |
| sx | Shorthand layout props | — | — |
Events
| Event | Description | Payload |
|---|---|---|
| load | Reached bottom (set loading / finished after fetching) | — |
| update:error | Retry click write-back (clears the controlled error) | (value: boolean) |
Slots
| Name | Description |
|---|---|
| default | List content |
| loading | Loading indicator (spinner by default) |
| finished | "No more items" text (locale key list.finished by default) |
| error | Error area (default "Failed to load, tap to retry" entry) |
| empty | Empty state (renders emptyText by default) |
Accessibility
- Root node
aria-busyreflects loading; accessible name fromariaLabel

