Base Library 3.3.0 or later is required. For earlier versions, see compatibility handling.
Related documentation: Skyline Rendering Engine, Getting Started with Skyline Migration
Rendering framework support: Skyline (use the latest Nightly tool for debugging)
Feature Description
List constructor, supported only as a direct child node of <scroll-view type="custom"> mode. For specific usage, refer to scroll-view
Common Properties
| Attribute | Type | Default | Required | Description | Minimum Version | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| padding | Array | [0, 0, 0, 0] | No | An array of length 4, specifying padding in the order of top, right, bottom, and left | ||||||||
| type | string | static | Yes | Type, defaults to fixed height mode | ||||||||
|
||||||||||||
| list | Array | Yes | The list used for rendering | |||||||||
| child-count | Array | No | The length of the complete list. If not passed, the length of list is used as its value | |||||||||
| child-height | Array | No | The height of list items. Must be passed when type is static | |||||||||
| bind:itembuild | eventhandle | No | Triggered when a list item is created. event.detail = {index}, where index is the index of the created list item | |||||||||
| bind:itemdispose | eventhandle | No | Triggered when a list item is recycled, event.detail = {index}, where index is the index of the recycled list item | |||||||||
| initial-child-count | number | 0 | No | The number of list items rendered during the initial render, used to reduce the white screen duration on the first load. If not provided, the first screen will also render items on-demand based on the layout results | 3.7.12 | |||||||
Bug & Tip
tip: Currently, only vertical scrolling lists are supported.
Usage
<scroll-view
type="custom"
scroll-y
>
<list-builder
list="{{list}}"
child-count="{{list.length}}"
child-height="200"
>
<view slot:item slot:index style="height: 200px;">
<view>{{item.id}}-{{index}}</view>
</view>
</list-builder>
</scroll-view>