Ionic 4-如何保持表单的固定高度,以防止打开键盘时提交按钮上升?
我想修复提交按钮总是在开始的位置,在屏幕的底部。
当我打开页面时,submit按钮位于屏幕底部。我希望当插入电子邮件或密码时,按钮将继续在屏幕底部,键盘将在它上面打开。
有人能帮我吗?
HTML
<ion-header mode="md" translucent="true">
<ion-toolbar>
<ion-buttons slot="start">
<ion-back-button text=""></ion-back-button>
</ion-buttons>
</ion-toolbar>
<ion-title>{{ 'loginEmail.title' | translate:params }}</ion-title>
</ion-header>
<ion-content padding>
<br>
<form [formGroup]="loginForm" (ngSubmit)="setLoginData()" style="height:auto !important">
<ion-label class="form-label" position="fixed">{{ 'loginEmail.email' | translate:params }}</ion-label>
<ion-input class="input" name="email" placeholder="{{ 'loginEmail.emailPlaceholder' | translate:params }}"
type="email" formControlName="email"></ion-input>
<br>
<ion-label class="form-label" position="fixed">{{ 'loginEmail.password' | translate:params }}</ion-label>
<ion-input class="input" name="password" placeholder="{{ 'loginEmail.passwordPlaceholder' | translate:params }}"
type="password" formControlName="password"></ion-input>
<div>
<a routerLink="/register4" class="forgotPassword">{{ 'loginEmail.forgotPassword' | translate:params }}</a>
</div>
<ion-button class="signIn" size="large" type="submit" [disabled]="loading" style="
margin-top: 360px;">
<label class="label">{{ 'loginEmail.buttonLabel' | translate:params }}</label>
</ion-button>
</form>
</ion-content>
SCSS
ion-header::after {
background-image: none;
--ion-background-color: #f0f2f4;
}
ion-header {
ion-toolbar {
ion-buttons {
ion-back-button {
color: #48385c !important;
}
a {
font-size: 25px;
padding-top: 4px;
width: 40px;
padding-left: 20px;
}
}
--ion-background-color: #f0f2f4;
}
ion-title {
font-family: Rubik;
font-style: normal;
font-weight: 500;
font-size: 24px;
line-height: 34px;
color: #183657;
background-color: #f0f2f4;
padding: 20px 20px 0px 20px;
}
}
ion-content {
--ion-background-color: #f0f2f4;
.title {
font-family: Rubik;
font-style: normal;
font-weight: 500;
font-size: 24px;
line-height: 30px;
text-align: center;
color: #183657;
}
.form {
display: flex;
align-items: center;
margin-left: 30px;
margin-right: 30px;
}
.input {
border: 1px solid #959393;
width: 100%;
height: 50px;
-moz-border-radius: 50px;
-webkit-border-radius: 50px;
border-radius: 10px;
margin-bottom: 10px;
}
.has-focus.sc-ion-input-md-h {
pointer-events: none;
border: 2px solid #187ceb !important;
}
ion-button {
text-transform: none;
display: block;
margin: 30px 0px 0px 0px;
font-weight: 600;
height: 50px;
--border-radius: 10px;
.label {
font-size: 16px;
padding-left: 15px;
}
}
.signIn {
--background: #187ceb;
bottom: 20px !important;
position: fixed;
width: calc(100% - 30px);
}
.forgotPassword {
font-family: Rubik;
font-style: normal;
font-weight: bold;
font-size: 16px;
line-height: 22px;
align-items: center;
text-align: center;
color: #183657;
text-decoration: none;
}
.signUp-label {
font-family: Rubik;
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 22px;
align-items: center;
text-align: center;
color: #183657;
}
.form-label {
font-family: Rubik;
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 34px;
display: flex;
align-items: center;
color: #48385c;
}
}
发布于 2020-06-28 00:57:46
尝试使用css属性Position: absolute;然后使用左上角右下角属性将其放在正确位置
对不起,?的拼写错误
https://stackoverflow.com/questions/62579000
复制相似问题