my.hideKeyboard
说明:mPaaS 10.1.32 及以上版本支持该接口。
该接口用于隐藏键盘。
代码示例
// API-DEMO page/API/keyboard/keyboard.json
{
"defaultTitle": "键盘"
}
<!-- API-DEMO page/API/keyboard/keyboard.axml-->
<view class="page">
<view class="page-description">输入框</view>
<view class="page-section">
<view class="form-row">
<view class="form-row-label">密码键盘</view>
<view class="form-row-content">
<input class="input" password type="text" onInput="bindHideKeyboard" placeholder="输入 123 自动收起键盘" />
</view>
</view>
<view class="form-row">
<view class="form-row-label">数字键盘</view>
<view class="form-row-content">
<input class="input" type="digit" onInput="bindHideKeyboard" placeholder="输入 123 自动收起键盘" />
</view>
</view>
</view>
</view>
// API-DEMO page/API/keyboard/keyboard.js
Page({
bindHideKeyboard(e) {
if (e.detail.value === "123") {
// 收起键盘
my.hideKeyboard();
}
},
});
文档内容是否对您有帮助?