HarmonyOS 父组件的圆角如何作用于子组件?

如下代码,给Swiper设置圆角后,如何让子组件的Image也显示圆角?

Swiper(){
  ForEach(this.bannerList,  (banner: NewsBannerContentlist, index: number) =>{
    Image(this.getImgUrl(banner.conentimg)).width('100%').height('100%')
  })
}.width(this.deviceWidth - CommonConstants.MARGIN_LEFT - CommonConstants.MARGIN_RIGHT)
.height((this.deviceWidth - CommonConstants.MARGIN_LEFT - CommonConstants.MARGIN_RIGHT) * 152 / 359)
.margin({
  left: CommonConstants.MARGIN_LEFT,
  right: CommonConstants.MARGIN_RIGHT
})
.clip(true)
.backgroundColor(Color.White)
.borderRadius(8)
.padding(2)
.indicator(
  Indicator.dot()
    .right(0)
    .itemWidth(6)
    .itemHeight(6)
    .selectedItemWidth(12)
    .selectedItemHeight(6)
    .color($r('app.color.color99FFFFFF'))
    .selectedColor(Color.White)
)
.loop(true)
.autoPlay(true)
.interval(5000)
阅读 470
1 个回答

子组件Image要再设置:

Image($r('app.media.ic_banner03')).border({
  radius: { topLeft: 8, topRight: 8, bottomLeft: 8, bottomRight: 8 }
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进