Angular 實現軟體盤 換行 改 搜尋 並且除非 搜尋方法:
Form 必須有 action="javascript: return true;”
input / ion-input type="search” (keyup.enter)="search()”
實測 ion-searchbar 需要設定 inputmode="" 而官方文件 inputmode="search"有時真的不靠譜!!
示例:
<form *ngIf="data" [formGroup]="formGroup" action="javascript: return true;"> <ng-container *ngFor="let item of data.data.formObj" [ngSwitch]="item.type"> <ng-container *ngSwitchCase="'input'"> <ion-item class="post-item"> <ion-label>{{item.label}}</ion-label> <ion-input type="search" [maxlength]="item.maxLength" [attr.placeholder]="item.placeHolder [formControlName]="item.formKey" [(ngModel)]="item.value" (keyup.enter)="search()"> </ion-input> </ion-item> </ng-container> </ng-container> </form>
<ion-searchbar (keyup.enter)="search()" inputmode="" [attr.placeholder]="item?.placeHolder" [(ngModel)]="item.value" [formControlName]="item.formKey"></ion-searchbar>