本文原创发布在华为开发者社区。
介绍
本示例展示了一个List嵌套Demo,其功能为List中嵌套List。
效果预览
使用说明
无
实现思路
List嵌套
List({ space: 5, initialIndex: 0 }) {
ForEach(this.list02, (item: number) => {
ListItem() {
Text('二级嵌套内容: ' + item )
.height(150)
.width('100%')
.fontSize(30)
.backgroundColor(Color.Green)
}
}, (item: string) => item)
}.listDirection(Axis.Vertical)
.scrollBar(BarState.Off)
.layoutWeight(1)
.nestedScroll({
scrollForward: NestedScrollMode.SELF_FIRST,
scrollBackward: NestedScrollMode.SELF_FIRST
})
})
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。