所谓占比能力,指的是:当父容器的尺寸发生变化时,子组件的宽或高按照预设的比例随之发生变化。

@Entry
@Component
struct Percent {build() {Row() { Text('T1')
.fontSize(88)
.textAlign(TextAlign.Center)
.backgroundColor('#F24E4E')
.width('25%')
Text('T2')
.fontSize(88)
.textAlign(TextAlign.Center)
.backgroundColor('#FFF24D')
.width('50%')
Text('T3')
.fontSize(88)
.textAlign(TextAlign.Center)
.backgroundColor('#45E5E1')
.width('25%')
}
.width('100%')
}
}@Entry
@Component
struct Percent {build() {Row() { Grid() {GridItem() { Text('T1')
.fontSize(88)
.textAlign(TextAlign.Center)
.backgroundColor('#F24E4E')
.width('100%')
}
GridItem() { Text('T2')
.fontSize(88)
.textAlign(TextAlign.Center)
.backgroundColor('#FFF24D')
.width('100%')
}
GridItem() { Text('T3')
.fontSize(88)
.textAlign(TextAlign.Center)
.backgroundColor('#45E5E1')
.width('100%')
}
}
.columnsTemplate('1fr 2fr 1fr')
.width('100%')
}
}
}
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧

售后响应及时
7×24小时客服热线
数据备份
更安全、更高效、更稳定
价格公道精准
项目经理精准报价不弄虚作假
合作无风险
重合同讲信誉,无效全额退款