【问题标题】:How to keep keyboard open in iOS and Android from Ionic 3 (Button click after text input)如何通过 Ionic 3 在 iOS 和 Android 中保持键盘打开(文本输入后单击按钮)
【发布时间】:2020-03-18 04:32:06
【问题描述】:

我旁边有一个离子输入和按钮(就像在聊天应用程序中输入聊天一样)。当我按下按钮时,键盘会一直关闭,我需要将其打开,直到用户单击硬件后退按钮两次/单击其他焦点区域。

<ion-input id="inputID" (keyup.enter)="sendMessage()" type="text" [(ngModel)]="replyMessage"
  (press)="onPastePress($event,message, showSelect)" placeholder="Type a message"></ion-input>
<button for="inputID" (click)="sendMessage()" [attr.disabled]="replyMessage==''?'':null" type="button">
  <!-- <ion-icon></ion-icon> -->
  <i class="material-icons" style="font-size: 14px;">
    send
  </i>
</button>

软件详情: 使用离子 - 3.20.1 安卓版 - @8+ iOS 版本 - @5+

【问题讨论】:

    标签: ionic-framework ionic3 ionic-native


    【解决方案1】:

    您可以使用键盘插件保持键盘打开:

    https://ionicframework.com/docs/v3/native/keyboard/

    import { Keyboard } from '@ionic-native/keyboard';
    
    constructor(private keyboard: Keyboard) { }
    
    ...
    
    this.keyboard.show();
    
    this.keyboard.hide();
    

    【讨论】:

      猜你喜欢
      • 2017-10-01
      • 2011-12-26
      • 2018-02-02
      • 1970-01-01
      • 2016-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多