borderRadius百分比不生效,可以根据onAreaChange自己封装个方法计算百分比。
image.png

@Entry
@Component
struct Page32 {
  @State private _viewWidth: number = 0;

  private getPercentOfWidth(percent: number): number {
    return this._viewWidth / 100 * percent;
  }

  build() {
    Column() {
      Text('哈哈')
        .width(200)
        .height(200)
        .textAlign(TextAlign.Center)
        .backgroundColor(Color.Pink)
        .borderRadius(this.getPercentOfWidth(15))//15%
        .onAreaChange((oldValue, newValue) => {
          this._viewWidth = newValue.width as number;
        })

    }
    .height('100%')
    .width('100%')
  }
}

zhongcx
1 声望3 粉丝