#鸿蒙学习大百科#如何实现TextInput输入完内容后点击回车的监听?

如何实现TextInput输入完内容后点击回车的监听?

HarmonyOS
2024-10-25 11:15:27
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
朝花惜拾丶
@Entry
@Component
struct Index {
  build() {
    Column() {
      TextInput({ placeholder: 'input your username' }).margin({ top: 20 })
        .onSubmit((EnterKeyType)=>{
          console.log("点击了回车")
        })
    }
    .width('100%')
    .height('100%')
    .justifyContent(FlexAlign.Center)
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
分享
微博
QQ
微信
回复
2024-10-25 15:44:23
相关问题
#鸿蒙学习大百科#如何实现ui优化?
1023浏览 • 1回复 待解决