All Products
Search
Document Center

Keyboard

Last Updated: Feb 04, 2021

my.hideKeyboard

Note: This interface is only supported in mPaaS 10.1.32 and later versions.

Hide the keyboard.

Code example

 
  1. // API-DEMO page/API/keyboard/keyboard.json
  2. {
  3. "defaultTitle": "Keyboard"
  4. }
 
  1. <!-- API-DEMO page/API/keyboard/keyboard.axml-->
  2. <view class="page">
  3. <view class="page-description">Input box</view>
  4. <view class="page-section">
  5. <view class="form-row">
  6. <view class="form-row-label">Password keyboard</view>
  7. <view class="form-row-content">
  8. <input class="input" password type="text" onInput="bindHideKeyboard" placeholder="Input 123 to automatically hide the keyboard" />
  9. </view>
  10. </view>
  11. <view class="form-row">
  12. <view class="form-row-label">Numeric keyboard</view>
  13. <view class="form-row-content">
  14. <input class="input" type="digit" onInput="bindHideKeyboard" placeholder="Input 123 to automatically hide the keyboard" />
  15. </view>
  16. </view>
  17. </view>
  18. </view>
 
  1. // API-DEMO page/API/keyboard/keyboard.js
  2. Page({
  3. bindHideKeyboard(e) {
  4. if (e.detail.value === "123") {
  5. //Hide keyboard
  6. my.hideKeyboard();
  7. }
  8. },
  9. });