HarmonyOS 在@CustomDialog中使用TextArea关闭弹窗后,键盘没有隐藏

@CustomDialog
export struct HpMatchRoomChatMsgDialog {
  build() {
    TextArea({
      placeholder: 'ArkTS提供了简洁自然的声明式语法',
      text: $$this.text,
      controller: this.textAreaController
    })
      .defaultFocus(true)
      .placeholderColor($r('app.color.tertiary_text'))
      .placeholderFont({
        size: $r('app.float.body2')
      })
      .fontSize($r('app.float.body2'))
      .fontColor($r('app.color.primary_text'))
      .backgroundColor($r('app.color.bg_click'))
      .borderRadius(2)
      .layoutWeight(1)
      .enterKeyType(EnterKeyType.Send)
      .onSubmit(() => {
        this.sendMsg()
      })
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
HarmonyOS
2024-12-25 12:34:14
634浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
put_get

参考示例:

@Entry
@Component
struct Page_3058 {
  @State message: string = 'Hello World';
  dialogController: CustomDialogController = new CustomDialogController({
    builder: CustomDialogExample(),
  })

  build() {
    Row() {
      Column() {
        Text(this.message)
          .fontSize(50)
          .fontWeight(FontWeight.Bold)
          .onClick(() => {
            this.dialogController.open()
          })
      }
      .width('100%')
    }
    .height('100%')
  }
}

@CustomDialog
struct CustomDialogExample {
  controller: CustomDialogController = new CustomDialogController({
    builder: CustomDialogExample({}),
  })
  Textcontroller: TextAreaController = new TextAreaController()
  @State text: string = ''

  build() {
    Column() {

      TextArea({
        placeholder: 'ArkTS提供了简洁自然的声明式语法',
        text: this.text,
        controller: this.Textcontroller
      })
        .maxLines(3)
        .defaultFocus(true)
        .borderRadius(2)
        .layoutWeight(1)
        .enterKeyType(EnterKeyType.Send)

    }.height('30%')
  }
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
分享
微博
QQ
微信
回复
2024-12-25 16:04:04


相关问题
HarmonyOS 如何先关闭键盘关闭弹窗
1290浏览 • 1回复 待解决
HarmonyOS TextArea与系统键盘使用方式
636浏览 • 1回复 待解决
HarmonyOS 安全控件无法弹窗中使用
1470浏览 • 1回复 待解决