Nhảy tới nội dung

my.hideKeyboard

hideKeyboard

my.hideKeyboard là API dùng để ẩn bàn phím.

Quét mã để trải nghiệm

Xem code mẫu trên Tini Studio

Sample Code

index.txml
<view>
<block-header
title="Usage"
description="The API for hiding the keyboard."
/>

<view class="block-content">
<text class="title mb-8">Example</text>
<view class="component-item">
<input
onInput="bindHideKeyboard"
placeholder="Enter 123 to automatically close the keyboard"
/>
</view>
</view>
</view>
index.js
Page({
bindHideKeyboard(e) {
if (e.detail.value === '123') {
my.hideKeyboard();
}
}
});