CardAdvTop.ets 1.25 KB
import PageModel from '../../viewmodel/PageModel';

/**
 * @Description: 广告稿件 顶部标签+删除按钮
 * @Author:
 * @Email: liyubing@wondertek.com.cn
 * @CreateDate:
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
@Component
export struct CardAdvTop {
  @State compIndex: number = 0;
  pageModel: PageModel = new PageModel();

  build() {

    Row() {
      Text($r('app.string.comp_advertisement'))
        .fontSize('10fp')
        .fontColor($r('app.color.white'))
        .width(28)
        .height(16)
        .backgroundColor('#4D000000')
        .borderRadius(4)
        .textAlign(TextAlign.Center)

      Blank()

      Stack() {
        Image($r('app.media.comp_adv_close_white'))
          .width(9)
          .height(9)
          .borderRadius({
            topLeft: '4vp',
            topRight: '4vp',
            bottomLeft: '4vp',
            bottomRight: '4vp'
          })
      }
      .width(18)
      .height(14)
      .backgroundColor('#4D000000')
      .borderWidth(0.5)
      .borderColor($r('app.color.white'))
      .borderRadius(4)

    }.width('100%').padding({
      top: 8,
      left: 8,
      right: 8
    }).onClick(() => {
      if (this.pageModel) {
        this.pageModel.compList.deleteItem(this.compIndex)
      }

    })
  }
}