You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ionic 4 Capacitor:已聚焦输入后点击其他输入时阻止键盘关闭

问题描述
  • 复现操作:在提供的APK内点击Login按钮即可复现问题
  • 具体异常表现:
    • 点击「Enter Email」输入框时,键盘弹出并正常上推页面
    • 点击「Enter Password」输入框时,键盘会先关闭再聚焦该输入框;点击Login按钮时也存在相同问题
  • 已尝试无效方案:添加(mousedown)="$event.preventDefault()",问题未解决
相关代码
<div class="sign-in-inputs-container">
    <!--Email-->
    <mat-form-field class="welcome-input welcome-input-text">
      <input matInput="" placeholder="Enter Email" [(ngModel)]="email">
    </mat-form-field>

    <!--Password-->
    <ng-container *ngIf="currentWelcomeState != WelcomeState.FORGOTPASSWORD">
      <mat-form-field class="welcome-input welcome-input-text">
        <input type="password" matInput="" placeholder="Enter Password" [(ngModel)]="password">
      </mat-form-field>
    </ng-container>
    

    <!--Login-->
    <button *ngIf="currentWelcomeState == WelcomeState.SIGNIN" (click)="signIn()" class="login-button welcome-input welcome-input-button" mat-raised-button="" color="primary">Login</button>

    <!--Forgot Password-->
    <button *ngIf="currentWelcomeState == WelcomeState.FORGOTPASSWORD" (click)="forgotPassword()" class="login-button welcome-input welcome-input-button" mat-raised-button="" color="primary">Forgot Password</button>
  </div>
</div>

内容的提问来源于stack exchange,提问作者Colin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.21 10:43:17