<form action="javascript:return true;">
<ion-row >
<ion-input mode="ios" [(ngModel)]="search" type="search" placeholder="请搜索" [ngModelOptions]="{standalone: true}" (keyup)="onSearchKeyUp($event)"></ion-input>
<div style="height: 30px;width: 30px;float: right;margin-right: 5px " (click)="searchBt()">
<ion-icon ios="ios-search" md="md-search"></ion-icon>
</div>
</ion-row>
</form>
ion-input 添加属性type="search", 注意一定要添加[ngModelOptions]="{standalone:true}"或name=‘search’否则会报错,添加手机键盘监听事件(keyup)=”onSearchKeyUp($event)”`
TS页面
onSearchKeyUp(event){
if("Enter"==event.key){
//function
}
}
网友评论