我有一个项目,当我在输入中写一些东西并按下手机键盘上的OK按钮时,我想专注于下一个输入。我该怎么做?这是我的密码:谢谢你的帮助!
<ion-list style="margin-top: 10%;">
<ion-item>
<ion-label position="floating" style="color: thistle; font-size: 20px;">Adınız : </ion-label>
<ion-input type="text" [(ngModel)]="user.name" (keyup.enter)="focusNext()" id="inputname" style="color:white" placeholder="Adınızı buraya giriniz.">
</ion-input>
</ion-item>
<ion-item>
<ion-label position="floating" style="color: thistle; font-size: 20px;">Soyadınız : </ion-label>
<ion-input type="text" id="inputsurname" [(ngModel)]="user.surname" style="color:white"
placeholder="Soyadınızı buraya giriniz."></ion-input>
</ion-item>
<ion-item>
<ion-label position="floating" style="color: thistle; font-size: 20px;">Email : </ion-label>
<ion-input type="email" id="inputemail" [(ngModel)]="user.email" style="color:white"
placeholder="Email adresinizi buraya giriniz."></ion-input>
</ion-item>
<ion-item>
<ion-label position="floating" style="color: thistle; font-size: 20px;">Telefon Numaranız : </ion-label>
<ion-input type="number" id="inputtel" [(ngModel)]="user.telno" style="color:white"
placeholder="Telefon Numaranızı buraya giriniz."></ion-input>
</ion-item>
<ion-item>
<ion-label position="floating" style="color: thistle; font-size: 20px;">Şifreniz : </ion-label>
<ion-input type="password" id="inputpass" [(ngModel)]="user.password" style="color:white"
placeholder="Şifrenizi buraya giriniz."></ion-input>
</ion-item>
html file
使用#passwordInput关注特定的输入
<ion-item>
<ion-input type="email" placeholder="Email" [(ngModel)]="loginparams.username"
(keypress)="onKeyPressed($event,'email')" enterkeyhint="next"></ion-input>
</ion-item>
<ion-item>
<ion-input type="password" placeholder="Password" [(ngModel)]="loginparams.password" enterkeyhint="done"
(keypress)="onKeyPressed($event,'password')" #passwordInput></ion-input>
</ion-item>
tsfile
@ViewChild('passwordInput', { static: false }) passwordInput;
onKeyPressed(event: any, fieldType?: any) {
if (event.keyCode == 13) { // click on enter focus to passwprd field
if (fieldType == 'email') {
this.passwordInput.setFocus();
} else{
}
}
}