1.0.6 • Published 6 years ago
ionic-page-search v1.0.6
Install
npm install ionic-page-search
Using ionic2-page-search module in an Ionic 2 app
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { AboutPage } from '../pages/about/about';
import { ContactPage } from '../pages/contact/contact';
import { HomePage } from '../pages/home/home';
import { TabsPage } from '../pages/tabs/tabs';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
/* 使用方法 */
/*------------------------------------------------*/
import { PageSearchModule } from 'ionic-page-search';
/*------------------------------------------------*/
@NgModule({
declarations: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
],
imports: [
BrowserModule,
/*------------------------------------------------*/
PageSearchModule,
/*------------------------------------------------*/
IonicModule.forRoot(MyApp),
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
AboutPage,
ContactPage,
HomePage,
TabsPage,
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
/*QQ442970923(如发现Bug请与我联系,将进行改进)*/
/*---------------------HTML---------------------*/
<ion-header>
<ion-navbar>
<ion-title>Home</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<page-search (ionChange)="ionChange()" SearchType="noContent" [(ngModel)]="SearchVal"></page-search>
</ion-content>
输入属性
名称 | 类型 | 默认 | 描述 |
---|---|---|---|
SearchType | string | 无 | 'tag'or'noContent' 搜索类型 |
type | string | 无 | input类型 |
clearText | string | '清除历史记录' | SearchType是tag类型的时候生效 |
cancelText | string | '取消' | 取消文字 |
position | string | 'content' | 'content'时上下收缩,其他值不收缩 |
ionic-page-event
key | 类型 | 描述 |
---|---|---|
ionfocus | event | 搜索框聚焦时 |
ionblur | event | 搜索框失去焦点时 |
ionkeydown | event | 键盘按下时 |
ioncancel | event | 取消按钮点击时 |
ionChange | event | input值改变时 |
ionkeyup | event | 键盘弹起时 |