SysUtils.ets 280 B

12345678910111213141516
  1. import inputMethod from '@ohos.inputMethod';
  2. /**
  3. * 隐藏键盘操作
  4. */
  5. export function hideKeyboard() {
  6. try {
  7. const ctrl = inputMethod.getController()
  8. if (ctrl) {
  9. ctrl.stopInputSession(() => {
  10. })
  11. }
  12. } catch (error) {
  13. // 处理隐藏失败
  14. }
  15. }