离子输入字段自动创建问题

Ionic Input filed auto create issue

我将 Ionic 3 用于我的移动应用程序,当我在想要自动创建下一个文件后在输入文件中键入内容时,我尝试创建,但它对我不起作用,任何人都知道如何正确地做到这一点

html

<ion-input type="text" placeholder="name" right (keyup.enter)="nextfiled()" ></ion-input>

.ts

nextfiled(value: string): void {
    alert('Submitted value: ' + value);
  }

.html

<ion-input (keypress)="eventHandler($event.keyCode)"></ion-input>

.ts

eventHandler(keypress) {
    console.log(keypress);
    if(keypress == 13) {
        //run code
    }
}

试试这个:

.html

<ion-item *ngFor="let item of textBox">
    <ion-input type="text" placeholder="name" [(ngModel)]="item.one" (keypress)="addTextBox($event.keyCode)"></ion-input>
</ion-item>

.ts

textBox:any = [{one:''}];

addTextBox(ev){
    console.log('isScroll',ev);
    if (ev == 13) {
        this.textBox.push({one:''});
    }
}