# Loadmore Used to display loading status at the bottom of lists. ## Basic Usage Introduce this component at the bottom of the list that needs to be loaded. When scrolling to the bottom of the list, display different text by setting `state`. ```html ``` ```scss :deep(.loadmore) { background-color: #f4f4f4; margin: 20px 0; } ``` ## Custom Text Display different text for different states by setting `loading-text`, `finished-text`, `error-text` along with `state` ```html ``` ## Click to Continue Loading When state is error, clicking on the text will trigger the `loadmore` event ```html ``` ## Application Implementation Implement loading more when scrolling to the bottom with the `onReachBottom` event ```html This is a test {{ index + 1 }} ``` ```typescript import { onLoad, onReachBottom } from '@dcloudio/uni-app' const state = ref('loading') const num = ref(0) const max = ref(60) onReachBottom(() => { if (num.value === 45) { state.value = 'error' } else if (num.value < max.value) { loadmore() } else if (num.value === max.value) { state.value = 'finished' } }) onLoad(() => { loadmore() }) function loadmore() { setTimeout(() => { num.value = num.value + 15 state.value = 'loading' }, 200) } ``` ```scss .list-item { position: relative; display: flex; padding: 10px 15px; background: #fff; color: #464646; } .list-item:after { position: absolute; display: block; content: ''; height: 1px; left: 0; width: 100%; bottom: 0; background: #eee; transform: scaleY(0.5); } image { display: block; width: 120px; height: 78px; margin-right: 15px; } .right { -webkit-box-flex: 1; -ms-flex: 1; flex: 1; } ``` ## Attributes | Parameter | Description | Type | Options | Default | Version | |-----------|-------------|------|----------|---------|----------| | state | Loading state | string | loading/finished/error | - | - | | loading-text | Loading prompt text | string | - | Loading... | - | | finished-text | Text prompt when all loading is complete | string | - | No more | - | | error-text | Text prompt when loading fails | string | - | Loading failed, click to retry | - | | loading-props | Loading component properties | `Partial` | - | - | 1.3.14 | #### LoadingProps See [LoadingProps](/component/loading.html#attributes) ## Events | Event Name | Description | Parameters | Version | |------------|-------------|------------|----------| | reload | Triggered when clicking the text when state is error | - | - | ## External Classes | Class Name | Description | Version | |------------|-------------|----------| | custom-class | Root node style | - |