HarmonyOS 代码是弹窗中的TextArea组件,在onAppear的时候获取焦点,有概率获取到焦点但是输入法未弹出

HarmonyOS
2025-01-09 16:07:49
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zbw_apple

参考示例如下:

focusControl.requestFocus("live_comment_text_input");
try {
  let textConfig: inputMethod.TextConfig = {
    inputAttribute: {
      textInputType: 0,
      enterKeyType: 1
    }
  };
  let inputMethodController = inputMethod.getController()
  inputMethodController.attach(true, textConfig).then(() => {
    console.log('Succeeded in attaching inputMethod.');
  }).catch((err: BusinessError) => {
    console.error(`Failed to attach: ${JSON.stringify(err)}`);
  })
} catch (err) {
  console.error(`Failed to attach: ${JSON.stringify(err)}`);
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
分享
微博
QQ
微信
回复
2025-01-09 19:42:10
相关问题
HarmonyOS TextArea获取焦点
538浏览 • 1回复 待解决
HarmonyOS TextArea组件如何主动获取焦点
557浏览 • 1回复 待解决
HarmonyOS 输入获取焦点后无法弹出
762浏览 • 1回复 待解决
HarmonyOS 主动获取组件焦点
844浏览 • 1回复 待解决
TextInput组件获取焦点几种场景
3948浏览 • 1回复 待解决
HarmonyOS 输入法高度如何确定
1364浏览 • 1回复 待解决
HarmonyOS Image获取焦点和失去焦点失效
603浏览 • 1回复 待解决
输入法编程接口吗?
5581浏览 • 1回复 待解决
HarmonyOS TextInput组件无法自动获取焦点
1022浏览 • 1回复 待解决