@Component
struct List {
@State message: string = 'Hello World'
arr:number[]=[1,2,3,4,5]
build() {
Row() {
Column(){
List({space:10}){
ForEach(this.arr,(s)=>{
ListItem(){
Text(`${s}`).fontSize(30).fontWeight(FontWeight.Bold)
}.border({style:BorderStyle.Solid}).height(40).width('90%').borderRadius(24)
.backgroundColor(Color.Pink)
})
}
}
.width('100%')
}
.height('100%')
}
}
效果如下: