合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
通用属性width支持设置变量。
- @Entry
- @Component
- struct Page1 {
- @State message: string = 'Hello';
- @State widthNum: number = 300;
-
- build() {
- Row() {
- Column() {
- Text(this.message)
- .fontSize(50)
- .fontWeight(FontWeight.Bold)
- .width(this.widthNum)
- .backgroundColor(Color.Blue)
- }
- .width('100%')
- }
- .height('100%')
- }
- }
效果如下所示:
