目录

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

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")
  }
}
本文是转载文章,点击查看原文
如有侵权,请联系 xyy@jishuzhan.net 删除
相关推荐
i200212093 小时前
【Harmonyos】项目开发总结--摇杆拖动侧重实现(适用游戏摇杆)
游戏·华为·面试·harmonyos·鸿蒙·鸿蒙系统
鸿蒙布道师5 小时前
鸿蒙NEXT开发土司工具类(ArkTs)
android·ios·华为·harmonyos·arkts·鸿蒙系统·huawei
娅娅梨6 小时前
HarmonyOS-ArkUI Ability进阶系列-UIAbility与各类Context
华为·harmonyos·arkts·arkui·移动端开发
咸鱼过江7 小时前
在openharmony中部署helloworld应用(超详细)
harmonyos
Jalor12 小时前
Flutter 与 HarmonyOS NEXT | IAPKit(应用内支付服务)避坑指南
前端·flutter·harmonyos
__Benco15 小时前
OpenHarmony子系统开发 - DFX(三)
人工智能·harmonyos
学海无涯乐作舟15 小时前
鸿蒙开发踩坑记录 - 2024S2
harmonyos
__Benco1 天前
OpenHarmony子系统开发 - DFX(一)
人工智能·harmonyos
Samson Bruce1 天前
从零开始开发HarmonyOS应用并上架
华为·harmonyos
90后的晨仔1 天前
鸿蒙开发报错Argument of type '(item: ObjectData) => number' is not xxxx
harmonyos