SingleImageCardAppComponent.ets 1.49 KB
import { Action, CompDTO, ContentDTO, Params } from 'wdBean';
import { CompStyle } from 'wdConstant';
import { Logger } from 'wdKit';
import { WDRouterRule } from 'wdRouter';

const TAG = 'SingleImageCardAppComponent';
const FULL_PARENT: string = '100%';

/**
 * 单图卡-3行标题/2行标题
 * 枚举值13
 *
 * 重磅推荐/精选/电视剧/电影/综艺/短剧/更多>/
 */
@Entry
@Component
export struct SingleImageCardAppComponent {
  @State compDTO: CompDTO = {} as CompDTO
  // @State compDTO: CompDTO = {
  //   operDataList: [
  //     {
  //       coverSize: '660*371',
  //       coverType: 1,
  //       coverUrl: 'https://cdnjdphoto.aikan.pdnews.cn/zhbj-20240116/image/content/a9028e7011bb440e94ba7c63d80b39b7.png?x-oss-process=image/resize,w_550/quality,q_90/format,jpg',
  //       newsTitle: '时政微观察丨从外贸“成绩单”看中国经济新亮色',
  //     } as ContentDTO
  //   ]
  // } as CompDTO

  aboutToAppear() {
  }

  build() {
    Column() {
      Text(this.compDTO.operDataList[0].newsTitle)
        .fontSize(16)
        .fontWeight(FontWeight.Bold)
        .alignSelf(ItemAlign.Start)
        .textOverflow({ overflow: TextOverflow.Ellipsis }) // 超出的部分显示省略号。
      Image(this.compDTO.operDataList[0].coverUrl)
        .borderRadius(5)
        .aspectRatio(16 / 9)
        .padding({ top: 10 })
      Image($r('app.media.icon_share'))
        .width(16)
        .height(16)
        .margin(10)
    }.alignItems(HorizontalAlign.End)
    .margin(16)
  }
}