tencent cloud

All product documents
Tencent Cloud Super App as a Service
Keyboard
Last updated: 2025-02-24 17:10:43
Keyboard
Last updated: 2025-02-24 17:10:43

updateKeyboard

This API is called using wx.updateKeyboard(Object object).
Feature description:Updates the content in the keyboard input box. This API only takes effect when the keyboard is already displayed.
Parameter and description: Object object.
Property
Type
Default value
‍Required
Description
value
string
-
True
The current value in the keyboard input box.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).

showKeyboard

This API is called using wx.showKeyboard(Object object).
Feature description:Displays the keyboard.
Parameter and description: Object object.
Property
Type
Default value
‍Required
Description
defaultValue
string
-
True
Default value displayed in the keyboard input box.
maxLength
number
-
True
Maximum length of text in the keyboard.
multiple
boolean
-
True
Whether the input is multiline.
confirmHold
boolean
-
True
Whether the keyboard remains displayed when the user clicks Done.
confirmType
string
-
True
The type of the Done button in the lower right corner of the keyboard. It only affects the text content of the button.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
Valid values for confirmType:
Value
Description
done
Complete
next
Next
search
Search
go
Go
send
Send

onKeyboardInput

This API is called using wx.onKeyboardInput(function listener).
Feature description:Listens for keyboard input event.
Parameter and description: function listener. The function that handles keyboard input event. Parameters are as follows:
Property
Type
Description
value
string
The current value of the keyboard input.

onKeyboardHeightChange

This API is called using wx.onKeyboardHeightChange(function listener).
Feature description:Listens for keyboard height change event.
Parameter and description: function listener. The function that handles keyboard height change event. Parameters are as follows:
listener parameter: Object res.
Property
Type
Description
height
number
Keyboard height.
Example:
wx.onKeyboardHeightChange(res => {
console.log(res.height)
})

onKeyboardConfirm

This API is called using wx.onKeyboardConfirm(function listener).
Feature description:Listens for the event where the user taps the Done button on the keyboard.
Parameter and description: function listener. The function that handles the Done button click event. Parameters are as follows:
Property
Type
Description
value
string
The current value of the keyboard input.

onKeyboardComplete

This API is called using wx.onKeyboardComplete(function listener).
Feature description:Listens for the event when the keyboard is hidden.
Parameter and description: function listener. The function that handles the keyboard hide event. Parameters are as follows:
Property
Type
Description
value
string
The current value of the keyboard input.

offKeyboardInput

The API is called using wx.offKeyboardInput(function listener).
Feature description:Removes the listener for keyboard input event.
Parameter and description: function listener. The function that was passed to onKeyboardInput. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onKeyboardInput(listener)
wx.offKeyboardInput(listener) // Must pass the same function object used in onKeyboardInput

offKeyboardHeightChange

This API is called using wx.offKeyboardHeightChange(function listener).
Feature description:Removes the listener for keyboard height change event.
Parameter and description: function listener. The function that was passed to onKeyboardHeightChange. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onKeyboardHeightChange(listener)
wx.offKeyboardHeightChange(listener) // Must pass the same function object used in onKeyboardHeight

offKeyboardConfirm

This API is called using wx.offKeyboardConfirm(function listener).
Feature description:Removes the listener for the event when the user taps the Done button on the keyboard.
Parameter and description: function listener. The function that was passed to onKeyboardConfirm. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onKeyboardConfirm(listener)
wx.offKeyboardConfirm(listener) // Must pass the same function object used in onKeyboardConfirm

offKeyboardComplete

This API is called using wx.offKeyboardComplete(function listener).
Feature description:Removes the listener for the event when the keyboard is hidden.
Parameter and description: function listener. The function that was passed to onKeyboardComplete. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onKeyboardComplete(listener)
wx.offKeyboardComplete(listener) // Must pass the same function object used in onKeyboardComplete

hideKeyboard

This API is called using wx.hideKeyboard(Object object).
Feature description:Hides the keyboard.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
Example:
wx.hideKeyboard({
complete: res => {
console.log('hideKeyboard res', res)
}
})


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon