openharmony 鸿蒙 arkts-basic-components-web-WebKeyboardController

2026-08-25 浏览 (1)

Class (WebKeyboardController)

Implements a controller to control the input, deletion, and closure of the custom keyboard. For details about the sample code, see onInterceptKeyboardAttach.

NOTE

  • The initial APIs of this component are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.

  • The initial APIs of this class are supported since API version 12.

  • The sample effect is subject to the actual device.

constructor12+

constructor()

Constructs a WebKeyboardController API.

System capability: SystemCapability.Web.Webview.Core

insertText12+

insertText(text: string): void

Inserts characters into the Web component text box.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
textstringYesCharacters to insert into the Web component text box.

deleteForward12+

deleteForward(length: number): void

Deletes a specified number of characters forward in a Web component text box.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
lengthnumberYesLength of characters to delete forward in a Web component text box.
Value range: [-2147483648, 2147483647]. If the parameter value exceeds the character length, all characters before the cursor are deleted by default. If the parameter value is a negative number, the deletion is not performed.

deleteBackward12+

deleteBackward(length: number): void

Deletes a specified number of characters backward in a Web component text box.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
lengthnumberYesLength of characters to delete backward in a Web component text box.
Value range: [-2147483648, 2147483647]. If the parameter value exceeds the character length, all characters after the cursor are deleted by default. If the parameter value is a negative number, the deletion is not performed.

sendFunctionKey12+

sendFunctionKey(key: number): void

Inserts a function key. Currently, only the Enter key type is supported. For details about the value, see EnterKeyType.

System capability: SystemCapability.Web.Webview.Core

Parameters

NameTypeMandatoryDescription
keynumberYesFunction key to insert into the Web component text box. Currently, only the Enter key is supported.

close12+

close(): void

Closes this custom keyboard.

System capability: SystemCapability.Web.Webview.Core

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 arkts-apis-webview-WebviewController

openharmony 鸿蒙 arkts-apis-webview-t

openharmony 鸿蒙 arkts-apis-webview

openharmony 鸿蒙 capi-arkweb-type-h

openharmony 鸿蒙 arkts-basic-components-web-FullScreenExitHandler

openharmony 鸿蒙 arkts-apis-webview-WebDownloadManager

openharmony 鸿蒙 arkts-basic-components-web-VerifyPinHandler

openharmony 鸿蒙 capi-web-arkweb-webmessage8h

openharmony 鸿蒙 arkts-apis-webview-NativeMediaPlayerHandler

openharmony 鸿蒙 capi-web-arkweb-proxymethodwithresult

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/x85BT2GB