@Entry
@Component
struct EventCase {
@State username: string = ''
@State password: string = ''
build() {
Row() {
Column({ space: 30 }) {
TextInput({ placeholder: '请输入用户名', text: $$this.username })
.height(40)
TextInput({ placeholder: '请输入密码', text: $$this.password })
.height(40)
.type(InputType.Password)
Button('登录')
.width('100%')
.onClick(() => {
// console.log( this.username)
})
}
.padding({
left: 20,
right: 20
})
.width('100%')
}
.height('100%')
}
}
这里用到了TextInput的属性 实现密码框的设置