全部产品

键盘

更新时间:2020-07-07 19:42:04

my.hideKeyboard

说明:mPaaS 10.1.32 及以上版本支持该接口。


该接口用于隐藏键盘。

代码示例

  1. // API-DEMO page/API/keyboard/keyboard.json
  2. {
  3. "defaultTitle": "键盘"
  4. }
  1. <!-- API-DEMO page/API/keyboard/keyboard.axml-->
  2. <view class="page">
  3. <view class="page-description">输入框</view>
  4. <view class="page-section">
  5. <view class="form-row">
  6. <view class="form-row-label">密码键盘</view>
  7. <view class="form-row-content">
  8. <input class="input" password type="text" onInput="bindHideKeyboard" placeholder="输入 123 自动收起键盘" />
  9. </view>
  10. </view>
  11. <view class="form-row">
  12. <view class="form-row-label">数字键盘</view>
  13. <view class="form-row-content">
  14. <input class="input" type="digit" onInput="bindHideKeyboard" placeholder="输入 123 自动收起键盘" />
  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. // 收起键盘
  6. my.hideKeyboard();
  7. }
  8. },
  9. });