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

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")
  }
}
相关推荐
不爱吃糖的程序媛20 分钟前
使用 hionic 将 Web 应用部署到鸿蒙PC平台
flutter·华为·harmonyos
慧海灵舟27 分钟前
鸿蒙零基础实战教程Day0:HarmonyOS NEXT 项目创建与环境准备
华为·harmonyos
G_dou_36 分钟前
Flutter三方库适配OpenHarmony【age_calculator】年龄计算器项目完整实战
flutter·harmonyos
慧海灵舟38 分钟前
阿里 AGenUI 开源库前后端实战教程 —— Day 6:鸿蒙端 Playground 官方示例项目解析
华为·开源·harmonyos·写文章,赢小鸿ai
慧海灵舟44 分钟前
鸿蒙零基础实战教程Day1:HarmonyOS ArkUI 入门实战
华为·harmonyos
痕忆丶1 小时前
openharmony北向开发基础之访问公共文件目录
harmonyos
特立独行的猫a1 小时前
OHOS (OpenHarmony) 鸿蒙的Rust 交叉编译环境搭建指南
华为·rust·harmonyos·鸿蒙pc
Swift社区1 小时前
HarmonyOS鸿蒙PC平台三方库移植使用vcpkg 移植 Crashpad 过程实战总结
华为·harmonyos
再见6581 小时前
鸿蒙原生开发实战:从零打造一款涂鸦板应用
华为·harmonyos
大雷神1 小时前
第42篇|拍摄预览浮层:让用户确认刚拍的成果
harmonyos