가상 리스트
가상 리스트 (List)
긴 목록을 효율적으로 렌더링하기 위한 가상 리스트(virtual list) 컴포넌트예요. 현재 화면에 보이는 영역만 그리고, 사용자가 스크롤해서 보이는 영역에 들어오면 그때 나머지를 렌더링해요. 다만 대부분의 상황에서는 NutUI가 제공하는 스크롤 로딩(Scrolling Loading) 컴포넌트를 먼저 쓰는 쪽이 권장돼요. 이 컴포넌트는 슬라이드 흰 화면, 위치 계산 부정확 같은 문제가 생길 수 있거든요.
출처: 문서
설치 (Install)
import { createApp } from 'vue'
import { List } from '@nutui/nutui'
const app = createApp()
app.use()
사용 예제 (Usage)
기본 사용법 (Basic Usage)
demo: list basic
API
Props
| Attribute | Description | Type | Default |
|---|---|---|---|
| height | The height/estimated height of the list item, supports unfixed height | Number | 80 |
| list-data | List data | any[] | [] |
| container-height | Container height(The maximum value cannot exceed the viewable area) | Number | Visual area height |
| buffer-size | data buffer length | Number | 5 |
| margin | The gap between the lists is consistent with the custom style | Number | 10 |
Slots
| Attribute | Description | Type |
|---|---|---|
| item | List item data | Object |
| index | Indexes | Number |
Events
| Event | Description | Arguments |
|---|---|---|
| scroll-bottom | Triggered when scrolling to the bottom | - |
| scroll-up | scroll up | - |
| scroll-down | scroll down | - |
더 알아보기 (Learn more)
이 글은 NutUI 공식 문서의 영문 원문을 한국어로 번역한 내용이에요. 최신 내용과 전체 문서는 아래 링크에서 확인할 수 있어요:
- 원문 문서: list doc.en-US.md
- NutUI GitHub 저장소: https://github.com/jd-opensource/nutui