import router from '@ohos.router';
class item{
name:string
image:ResourceStr
price:Number
constructor(name:string,image:ResourceStr,price:number) {
this.name=name
this.image=image
this.price=price
}
}
@Entry
@Component
struct Productlist {
private items:Array<item>=[
new item('我',$r('app.media.wo'),520),
new item('爱',$r('app.media.ai'),520),
new item('超',$r('app.media.chao'),520),
new item('你',$r('app.media.ni'),520),
]
build() {
Column()
{
List({space:10}){
ForEach(
this.items,
(item:item)=>{
ListItem(){
Row({space:30}){
Image(item.image)
.width(200)
Column(){
Text(item.name)
.fontSize(50)
.fontColor(Color.Red)
Text(''+item.price)
.fontSize(50)
}
}
}
}
)
}
.width('100%')
}
.height('100%')
}
}
