我已经使用Ionic4开发了一个android应用程序。我面临的问题是,当键盘出现时,它覆盖了输入字段,屏幕没有向上移动。 我已通过以下代码行在Ionic 3中解决了此问题。但这在Ionic4中不起作用。有人请帮忙。
imports: [
IonicModule.forRoot(MyApp, {
scrollAssist: true,
autoFocusAssist: true
})
],
<div class="field-container">
<form [formGroup]="credentialsForm" class="width-100">
<ion-list>
<ion-item no-padding class="transparent-border">
<div class="logo-div">
<img src="assets/icon/favicon.png" class="app-logo">
</div>
</ion-item>
<ion-item no-padding>
<ion-label position="floating" color="primary">Username</ion-label>
<ion-input type="text" color="primary" mode="ios" maxLength="5" formControlName="userName" required></ion-input>
</ion-item>
<span class="validation-errors" *ngIf="!credentialsForm.controls.userName.valid && (credentialsForm.controls.userName.dirty || onSaveAttempt)">Username
is mandatory</span>
<ion-item no-padding>
<ion-label position="floating" color="primary">Password</ion-label>
<ion-input color="primary" type="password" mode="ios" formControlName="password" required></ion-input>
</ion-item>
<span class="validation-errors" *ngIf="!credentialsForm.controls.password.valid && (credentialsForm.controls.password.dirty || onSaveAttempt)">Password
is mandatory</span>
<ion-item no-padding class="transparent-border">
<div style="overflow: hidden;width: 100%">
<p class="create-account" (click)="doRegistrationNavigation()">Create an Account</p>
<p class="forgot-password">Forgot password?</p>
</div>
</ion-item>
</ion-list>
</form>
<ion-button (click)="doLogin()" expand="block" shape="round" class="signin-button" color="vibrant">Sign
In</ion-button>
</div>
答案 0 :(得分:0)
尝试一下
fetch(URL_TARGET+"/v1/login", {
method: 'post',
body: JSON.stringify({
username: username,
password: password
}
}).then(function(response) {
return response.json();
}).then(function(data) {
console.log(data);
});