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

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")
  }
}
相关推荐
Georgewu9 小时前
【 HarmonyOS 5 入门系列 】鸿蒙HarmonyOS示例项目讲解
harmonyos
libo_202510 小时前
HarmonyOS5 元宇宙3D原子化服务开发实践
harmonyos
半路下车10 小时前
【Harmony OS 5】DevEco Testing重塑教育质量
harmonyos·arkts
90后的晨仔11 小时前
解析鸿蒙 ArkTS 中的 Union 类型与 TypeAliases类型
前端·harmonyos
风浅月明11 小时前
[Harmony]颜色初始化
harmonyos·color
风浅月明11 小时前
[Harmony]网络状态监听
harmonyos·网络状态
半路下车11 小时前
【Harmony OS 5】DevEco Testing在教育领域的应用与实践
harmonyos·产品
simple丶11 小时前
【HarmonyOS Relational Database】鸿蒙关系型数据库
harmonyos·arkts·arkui
哼唧唧_12 小时前
使用 React Native 开发鸿蒙(HarmonyOS)运动健康类应用的系统化准备工作
react native·react.js·harmonyos·harmony os5·运动健康
三掌柜66612 小时前
HarmonyOS开发:显示图片功能详解
华为·harmonyos