鸿蒙开发系列教程(二十七)--案例:商品评价

1、商品评价标题

2、商品评价内容

3、整合调用

4、参考完整代码

@Entry
@Component
struct main {

  build() {
    Column () {
      EvaluationTitle()
      EvaluationItem()
    }
  }
}

@Component
struct EvaluationTitle {
  build() {
    Row(){
      Row() {
        Image($r("app.media.a6"))
          .width(16)
          .height(16)
          .fillColor('#848484')
      }
      .justifyContent(FlexAlign.Center)
      .width(24)
      .aspectRatio(1)
      .backgroundColor("#ffb9b3bc")
      .borderRadius(12)
      .margin({
        left: 15
      })
      Text("商品评价")
        .layoutWeight(1)
        .textAlign(TextAlign.Center)
        .fontSize(18)
        .padding({
          right: 39
        })
    }
    .height(40)
    .border({
      color: '#ffde3b3b',
      width: {
        bottom: 0.5
      }
    })
  }
}

@Component
struct EvaluationItem {
  build() {
    Row() {
      // 头像
      Image('/assets/test.jpeg')
        .width(32)
        .aspectRatio(1)
        .borderRadius(16)
      // 评论内容
      Column({ space: 10 }) {
        Text("用户36110")
          .fontWeight(FontWeight.Bold)
        Text("兔粮兔子饲料兔子粮食幼兔兔粮荷兰猪饲料提摩西兔草宠物兔子用品,兔子很爱吃!")
          .lineHeight(20)
          .fontSize(16)
          .fontColor('#565656')

        Row() {
          Text("2024-03-19 .ip属地哈尔滨")
            .fontSize(16)
            .fontColor("#c3c4c5")
          Row() {
            Image($r("app.media.a8"))
              .width(12)
              .aspectRatio(1)
              .fillColor('#c3c4c5')
              .margin({
                right: 5
              })
            Text("300")
              .fontSize(12)
              .fontColor("#c3c4c5")
          }
        }.justifyContent(FlexAlign.SpaceBetween)
        .width('100%')
      }
      .alignItems(HorizontalAlign.Start)
      .layoutWeight(1)
      .margin({
        left: 10
      })
    }.padding(15)
    .alignItems(VerticalAlign.Top)
    .backgroundColor("#fff5f2dc")
  }
}
相关推荐
张帅涛_6661 小时前
HarmonyOS ArkUI 构建布局
华为·harmonyos
可惜已不在4 小时前
华为 HCIP-Datacom H12-821 题库 (25)
网络·华为
冯志浩11 小时前
Harmony NEXT:如何给数据库添加自定义分词
harmonyos·掘金·金石计划
爱桥代码的程序媛13 小时前
鸿蒙OpenHarmony【轻量系统芯片移植案例】标准系统方案之瑞芯微RK3568移植案例
嵌入式硬件·harmonyos·鸿蒙·鸿蒙系统·移植·openharmony·鸿蒙开发
AORO_BEIDOU13 小时前
防爆手机+鸿蒙系统,遨游通讯筑牢工业安全基石
5g·安全·智能手机·信息与通信·harmonyos
逢生博客1 天前
Mac 搭建仓颉语言开发环境(Cangjie SDK)
macos·华为·鸿蒙
青柠_项目管理1 天前
PMP证书持有者,在华为、腾讯一般能拿多少薪资?
华为·pmp
小强在此1 天前
【基于开源鸿蒙(OpenHarmony)的智慧农业综合应用系统】
华为·开源·团队开发·智慧农业·harmonyos·开源鸿蒙
Reuuse1 天前
【HCIA-Datacom】华为VRP系统
服务器·网络·华为