LoadMore Load more
Display paging state with retry and viewport-triggered loading.
Import
Use <hui-load-more> with uni-app easycom. Import public types from @nscode/handy-uni. For ordinary Vue 3, install the preview plugin from @nscode/handy-uni/web and register its components.
Examples
Interact with the controls to see values and event results on the page.
vue
<template>
<view>
<hui-load-more ref="control" :status="status" @load="event0" @retry="event1" />
<hui-button @click="status = status === 'idle' ? 'error' : 'idle'"
>切换错误 / Toggle error</hui-button
>
<hui-load-more status="loading" /><hui-load-more status="finished" />
<hui-button @click="() => control?.check()">check()</hui-button>
<text>{{ lastEvent }}</text>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
const lastEvent = ref('No event yet')
const control = ref()
const status = ref<'idle' | 'loading' | 'finished' | 'error'>('idle')
const event0 = () => {
lastEvent.value = 'load'
}
const event1 = () => {
lastEvent.value = 'retry'
}
</script>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
status | LoadMoreStatus | 'idle' | Paging display state. |
idleText | string | — | Text shown when more data can be loaded. |
loadingText | string | — | Text displayed while loading. |
finishedText | string | — | Text shown when no more data is available. |
errorText | string | — | Error-state text. |
autoTrigger | boolean | false | Try loading when the indicator enters the viewport. |
offset | number | 100 | Badge offset or early loading distance, in px. |
Root attributes: common props. A Boolean default of undefined supports inheritance; explicit false overrides it. Other Boolean props default to false unless listed otherwise.
Events
| Event | Parameters | Description |
|---|---|---|
load | () | Request the next page. |
retry | () | Request retry after an error. |
Slots
| Slot | Parameters | Description |
|---|---|---|
default | { status } | Main content. |
loading | — | Custom loading region; replaces its fallback content. |
finished | — | Custom finished region; replaces its fallback content. |
error | — | Custom error region; replaces its fallback content. |
Methods
| Method | Signature | Description |
|---|---|---|
check | (): Promise<void> | Check whether automatic loading is needed. |
Types
LoadMoreProps、LoadMoreStatus、LoadMoreExpose、LoadMoreEmits are available from @nscode/handy-uni.
ts
export type LoadMoreStatus = 'idle' | 'loading' | 'finished' | 'error'
Platform notes
| Behavior | uni-app H5 | WeChat Mini Program | App-vue | Ordinary Vue 3 Web (preview) |
|---|---|---|---|---|
| Basic interaction | Supported; device checks pending | Supported; device checks pending | Supported; device checks pending | Supported by the web platform adapter |
Follow the smoke checklist. Device evidence is tracked separately; unit tests do not establish device acceptance.