PeopleShipHomePageHeadComponent.ets 1.05 KB
@Component
export struct PeopleShipHomePageHeadComponent {
  @State diameter: number = 30
  @State iconDiameter: number = 10
  @Prop headPhotoUrl: string | ResourceStr = ''
  @Prop authIcon: string = ''

  build() {
      Stack({ alignContent: Alignment.BottomEnd }) {
        // 头像
        Image( this.headPhotoUrl )
          .alt($r('app.media.WDAccountOwnerHedaerDefaultIcon'))
          .width(this.diameter)
          .height(this.diameter)
          .borderRadius(this.diameter/2)
          .borderWidth('0.5vp')
          .borderStyle(BorderStyle.Solid)
          .shadow({radius: 10, color: '#222226bd'})
          .borderColor(Color.White)
          .objectFit(ImageFit.Cover)
          .backgroundColor(Color.White)
          if(this.authIcon.length > 0 ) {
            Image( this.authIcon )
              .width(this.iconDiameter)
              .height(this.iconDiameter)
              .borderRadius(this.iconDiameter/2)
              .objectFit(ImageFit.Cover)
              .margin({
                right: '-3vp'
              })
          }
      }
  }
}