下面是一个使用 List 组件显示列表数据的示例代码:@Component struct MyList { @State data: string[] = ['item1', 'item2', 'item3'] build() { List({ itemHeight: 50, space: 10 }) { ForEach(this.data, (item) => { Text(item) }) } } }
下面是一个使用 List 组件显示列表数据的示例代码: