可以使用list组件进行列表展示,并通过list的initialIndex参数实现优先显示在底部的最新内容,示例demo如下:@Entry @Component struct Index { @State message: string = 'Hello World'; @State list: string[] = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'] build() { Column() { List({ space: 10, initialIndex: this.list.length - 1 }) { ForEach(this.list, (item: string) => { ListItem() { Text(item).fontSize(20).fontWeight(FontWeight.Bold).textAlign(TextAlign.Center) }.height(400).width('100%').backgroundColor(Color.Orange) }) } } .width("100%") .height("100%") .justifyContent(FlexAlign.Center) } }
可以使用list组件进行列表展示,并通过list的initialIndex参数实现优先显示在底部的最新内容,示例demo如下: