)
本/输入框TextTextInputText展示静态文本支持设置丰富的字体样式、背景、边框、间距TextInput单行文本输入框是表单收集信息的核心组件支持设置输入类型普通/密码、占位提示属性placeholder未输入时的占位提示文字type输入类型InputType.Password代表密码输入会隐藏内容onChange输入内容变化时触发回调可以拿到最新输入内容代码示例EntryComponentstruct FormDemo {Stateusername: string ;Statepassword: string ;build() {Column({ space: 15 }) {Text(账号).fontSize(16).width(100%)TextInput({ placeholder: 请输入账号, text: this.username }).width(100%).height(40).onChange((val) {this.username val; // 输入内容变化同步到状态变量})Text(密码).fontSize(16).width(100%)TextInput({ placeholder: 请输入密码, text: this.password }).width(100%).height(40).type(InputType.Password).onChange((val) {this.password val;})}.padding(15)}}登录注册表单输入框运行效果图