1 个回答

代码实现如下:

@Entry
@Component
struct Index {
  @State text: string = '合集·哈哈哈哈';

  build() {
    Column() {
      Row() {
        Image($r('app.media.startIcon'))
          .height(32)
          .width(32)
        Text(this.text)
          .maxLines(1)
          .flexShrink(1)
          .textOverflow({overflow: TextOverflow.Ellipsis})
          .fontSize(20)
        Text('更新7集')
          .fontSize(10)
      }
      .onClick(() => {
        this.text += '哈';
      })
      .width('80%')
      .height(50)
    }
    .height('100%')
    .width('100%')
    .justifyContent(FlexAlign.Center)
  }
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进