本文原创发布在华为开发者社区

介绍

本示例展示了一个List嵌套Demo,其功能为List中嵌套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
      })
})

鸿蒙场景化代码
1 声望0 粉丝