guochunsong

appstyle: 13 card

  1 +import { Action, CompDTO, ContentDTO, Params } from 'wdBean';
  2 +import { CompStyle } from 'wdConstant';
  3 +import { Logger } from 'wdKit';
  4 +import { WDRouterRule } from 'wdRouter';
  5 +
  6 +const TAG = 'SingleImageCardAppComponent';
  7 +const FULL_PARENT: string = '100%';
  8 +
  9 +/**
  10 + * 单图卡-3行标题/2行标题
  11 + * 枚举值13
  12 + *
  13 + * 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/
  14 + */
  15 +@Entry
  16 +@Component
  17 +export struct SingleImageCardAppComponent {
  18 + @State compDTO: CompDTO = {} as CompDTO
  19 + // @State compDTO: CompDTO = {
  20 + // operDataList: [
  21 + // {
  22 + // coverSize: '660*371',
  23 + // coverType: 1,
  24 + // coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/a9028e7011bb440e94ba7c63d80b39b7.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
  25 + // newsTitle: '时政微观察丨从外贸“成绩单”看中国经济新亮色',
  26 + // } as ContentDTO
  27 + // ]
  28 + // } as CompDTO
  29 +
  30 + aboutToAppear() {
  31 + }
  32 +
  33 + build() {
  34 + Column() {
  35 + Text(this.compDTO.operDataList[0].newsTitle)
  36 + .fontSize(16)
  37 + .fontWeight(FontWeight.Bold)
  38 + .alignSelf(ItemAlign.Start)
  39 + .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
  40 + Image(this.compDTO.operDataList[0].coverUrl)
  41 + .borderRadius(5)
  42 + .aspectRatio(3 / 2)
  43 + .padding({ top: 10 })
  44 + Image($r('app.media.icon_share'))
  45 + .width(16)
  46 + .height(16)
  47 + .margin(10)
  48 + }.alignItems(HorizontalAlign.End)
  49 + .margin(16)
  50 + }
  51 +}