如何在Ionic 3中隐藏键盘? [英] How to Hide Keyboard in Ionic 3?

查看:352
本文介绍了如何在Ionic 3中隐藏键盘?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在ionic3中隐藏键盘?

How to Hide Keyboard in ionic3?

在iPhone中进行测试时,我们遇到了ionic 3应用程序的问题.填写了Paygate Gateway信息(在iFrame中启动)后,只要我们使用后退"按钮转到上一页,键盘就不会隐藏.

We have a problem with ionic 3 apps during testing in iPhone. After fillup Payment Gateway information (which is launched in iFrame), Whenever we go to the back page using the back button, Keyboard is not Hiding.

我们使用了cordova-plugin-ionic-keyboard并使用Keyboard.hide()方法.但是没用.

We used cordova-plugin-ionic-keyboard and use Keyboard.hide() method. But didn't work.

推荐答案

尝试一下

import { Keyboard } from '@ionic-native/keyboard';

@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
 constructor(public navCtrl: NavController, public keyboard : Keyboard) {
  }
}

然后在返回按钮上使用此

and then on back button use this

this.keyboard.close()

这篇关于如何在Ionic 3中隐藏键盘?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆