AI浪潮下,企业如何挑选内训机构?四大核心维度与高分机构推荐
2026/6/23 3:32:10
Text 用于展示静态文字内容;TextInput 提供输入交互区域,接收用户手动输入文本,常用于登录、表单填写页面。
@Entry @Component struct TextDemo1{ build() { Column({space:50}){ Text('这是一段文本!') .fontSize(30) .fontWeight(FontWeight.Bold) .textAlign(TextAlign.Center) .width('100%') TextInput({placeholder:"请输入账号"}) .type(InputType.Normal) .height(60) .width(300) .backgroundColor(0xFFF0F2F5 ) .borderRadius(16) } .width('100%') .height('100%') } }提供可点击交互控件,绑定点击事件执行业务逻辑,支持自定义尺寸、背景、文字、边框、圆角样式。
@Entry @Component struct ButtonDemo1{ build() { Column({space:20}){ Button('确认提交') .height(50) .width(150) .backgroundColor(0xFF2A5E9E) .fontSize(28) .fontWeight(FontWeight.Medium) Button('取消操作') .height(50) .width(150) .backgroundColor(0xFF2A5E9E) .fontSize(28) .fontWeight(FontWeight.Medium) Button('确认删除') .height(50) .width(150) .backgroundColor(0xFF2A5E9E) .fontSize(28) .fontWeight(FontWeight.Medium) Button('登录') .height(50) .width(150) .backgroundColor(Color.Transparent) .fontSize(26) .fontColor(Color.Black) .borderRadius(35) .border({width:5,color:0xFFFF99AA}) .fontWeight(FontWeight.Medium) } .width('100%') .height('100%') .justifyContent(FlexAlign.Center) .alignItems(HorizontalAlign.Center) } }分组单选控件,同一 group 分组内仅可选中一项,用于问卷、性别、单项选择表单场景。
@Entry @Component struct RadioDemo1{ build() { Column(){ Text('第一题') Radio({ value: 'Radio1', group: 'radioGroup' }) .checked(false) .height(30) .width(30) Radio({ value: 'Radio2', group: 'radioGroup' }) .checked(true) .height(30) .width(30) Radio({ value: 'Radio3', group: 'radioGroup' }) .checked(false) .height(30) .width(30) Radio({ value: 'Radio4', group: 'radioGroup' }) .checked(false) .height(30) .width(30) Text('第二题') Radio({ value: 'Radio1', group: 'radioGroup1' }) .checked(false) .height(30) .width(30) Text('A') Radio({ value: 'Radio2', group: 'radioGroup1' }) .checked(true) .height(30) .width(30) Text('B') Row(){ Text('性别:') Radio({ value: '女', group: 'sex' }) .checked(true) .height(30) .width(30) Text('女') .fontSize(20) .margin({right:20}) Radio({ value: '男', group: 'sex' }) .checked(false) .height(30) .width(30) Text('男') .fontSize(20) } .margin({top:30}) } .width('100%') .height('100%') } }二元切换控件,支持按钮样式、滑块开关样式,用于开启 / 关闭类功能设置。
@Entry @Component struct ToggleDemo{ build() { Column(){ Toggle({ type:ToggleType.Button, isOn:true }) .width(150) .height(50) .selectedColor(Color.Yellow) .id('n1') Toggle({ type:ToggleType.Switch, isOn:false }) .width(150) .height(50) .selectedColor(0xFFD0E8FF) .switchPointColor(Color.Pink) .id('n2') } .width('100%') .height('100%') } }