docs/component/list-builder.md
::: sourceCode
:::
| Web | 微信小程序 | Android | iOS | HarmonyOS | HarmonyOS(Vapor) |
|---|---|---|---|---|---|
| <a style="color:unset;" href="https://vote.dcloud.net.cn/#/?name=uni-app%20x">x</a> | 4.41 | <a style="color:unset;" href="https://vote.dcloud.net.cn/#/?name=uni-app%20x">x</a> | <a style="color:unset;" href="https://vote.dcloud.net.cn/#/?name=uni-app%20x">x</a> | <a style="color:unset;" href="https://vote.dcloud.net.cn/#/?name=uni-app%20x">x</a> | - |
| 名称 | 类型 | 默认值 | 兼容性 | 描述 |
|---|---|---|---|---|
| padding | Array | - | Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: x; HarmonyOS(Vapor): - | (Array) |
| 长度为 4 的数组,按 top、right、bottom、left 顺序指定内边距 | ||||
| type | string | - | Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: x; HarmonyOS(Vapor): - | (string) |
| 类型,默认为定高模式 | ||||
| list | Array | - | Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: x; HarmonyOS(Vapor): - | (Array) |
| 需要用于渲染的列表 | ||||
| child-count | Array | - | Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: x; HarmonyOS(Vapor): - | (Array) |
| 完整列表的长度,如果不传则取 list 的长度作为其值 | ||||
| child-height | Array | - | Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: x; HarmonyOS(Vapor): - | (Array) |
| 列表项的高度,当 type 为 static 时必须传入 | ||||
| @itembuild | eventhandle | - | Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: x; HarmonyOS(Vapor): - | (eventhandle) |
| 列表项创建时触发,event.detail = {index},index 即被创建的列表项序号 | ||||
| @itemdispose | eventhandle | - | Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: x; HarmonyOS(Vapor): - | (eventhandle) |
| 列表项回收时触发,event.detail = {index},index 即被回收的列表项序号 |
| 合法值 | 兼容性 | 描述 |
|---|---|---|
| static | Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: x; HarmonyOS(Vapor): - | 定高模式,所有列表项等高,需要传入 child-height |
| dynamic | Web: x; 微信小程序: 4.41; Android: x; iOS: x; HarmonyOS: x; HarmonyOS(Vapor): - | 不定高模式 |