8 files added
8 files modified
9 files deleted
| | |
| | | import { SplashScreen } from '@ionic-native/splash-screen'; |
| | | import { KlCoreModule } from 'kl/core'; |
| | | |
| | | |
| | | @NgModule({ |
| | | declarations: [ |
| | | MyApp |
New file |
| | |
| | | {"1":{"dataType":"1","id":"1","name":"name1"},"2":{"dataType":"2","id":"2","name":"name2"},"3":{"dataType":"3","id":"3","name":"name3","dataList":[{"id":"1","vel":"v1"},{"id":"2","vel":"v2"},{"id":"3","vel":"v3"},{"id":"4","vel":"v4"}]},"4":{"dataType":"4","id":"4","name":"name4"}} |
| | |
| | | import { LoadingService } from './loading.service'; |
| | | import { ApiResult } from 'kl/model'; |
| | | |
| | | |
| | | |
| | | @Injectable() |
| | | export class HttpClient { |
| | | |
| | |
| | | this.getResponse(this.http.post(api, params), fun); |
| | | } |
| | | |
| | | getData(id: string, fun: Function) { |
| | | return this.http.get('assets/json/data.json').map((res: Response) => res.json()).subscribe(data => { |
| | | fun(data[id]); |
| | | }); |
| | | } |
| | | |
| | | |
| | | xhrPost(api, data, fun) { |
| | | let xhr = new XMLHttpRequest(); |
| | | xhr.open('POST', api, false); |
New file |
| | |
| | | <ion-item> |
| | | <ion-label>多选2</ion-label> |
| | | <ion-checkbox ></ion-checkbox> |
| | | </ion-item> |
New file |
| | |
| | | import { Component, Input } from '@angular/core'; |
| | | import { HttpClient } from 'kl/core/services/httpclient'; |
| | | |
| | | @Component({ |
| | | selector: 'test-checkbox', |
| | | templateUrl: 'checkbox.html' |
| | | }) |
| | | export class CheckboxComponent { |
| | | |
| | | @Input() |
| | | id = ''; |
| | | @Input() |
| | | data = { |
| | | id: '0', |
| | | name: 'err', |
| | | type: 1, |
| | | max: '', |
| | | minx: '' |
| | | }; |
| | | |
| | | constructor(private http: HttpClient) {} |
| | | |
| | | getData() { |
| | | this.http.getData(this.id, res => this.data = res); |
| | | } |
| | | |
| | | ngOnInit(): void { |
| | | this.getData(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | import { NgModule } from '@angular/core'; |
| | | import { InputComponent } from './input/input'; |
| | | import { IonicPageModule } from 'ionic-angular'; |
| | | import { SelectComponent } from './select/select'; |
| | | import { CheckboxComponent } from './checkbox/checkbox'; |
| | | |
| | | @NgModule({ |
| | | declarations: [ |
| | | InputComponent, |
| | | SelectComponent, |
| | | CheckboxComponent |
| | | ], |
| | | imports: [ |
| | | IonicPageModule.forChild(InputComponent), |
| | | IonicPageModule.forChild(SelectComponent), |
| | | IonicPageModule.forChild(CheckboxComponent) |
| | | ], |
| | | exports: [ |
| | | InputComponent, |
| | | SelectComponent, |
| | | CheckboxComponent |
| | | ] |
| | | }) |
| | | export class ComponentsModule {} |
| | |
| | | <!-- Generated template for the InputComponent component --> |
| | | |
| | | <ion-header> |
| | | |
| | | <ion-navbar> |
| | | <ion-title>input</ion-title> |
| | | </ion-navbar> |
| | | |
| | | </ion-header> |
| | | <ion-content padding> |
| | | <ion-list col text-center> |
| | | |
| | | </ion-list> |
| | | </ion-content> |
| | | <ion-row> |
| | | <ion-item *ngIf = 'data !== undefined'> |
| | | <ion-label fixed>{{data.name}}</ion-label> |
| | | <ion-input [type]="inputType" value=""></ion-input> |
| | | </ion-item> |
| | | </ion-row> |
| | |
| | | import { Component } from '@angular/core'; |
| | | import { IonicPage } from 'ionic-angular'; |
| | | import { Component, Input } from '@angular/core'; |
| | | import { HttpClient } from 'kl/core'; |
| | | |
| | | /** |
| | | * Generated class for the InputComponent component. |
| | |
| | | * See https://angular.io/docs/ts/latest/api/core/index/ComponentMetadata-class.html |
| | | * for more info on Angular Components. |
| | | */ |
| | | |
| | | |
| | | @IonicPage({ |
| | | name: 'access-input' |
| | | }) |
| | | @Component({ |
| | | selector: 'page-input', |
| | | templateUrl: 'input.html', |
| | | selector: 'test-input', |
| | | templateUrl: 'input.html' |
| | | }) |
| | | export class InputPage { |
| | | export class InputComponent { |
| | | |
| | | text: string; |
| | | @Input() |
| | | id = ''; |
| | | @Input() |
| | | data = { |
| | | id: '0', |
| | | name: 'err', |
| | | type: 1, |
| | | max: '', |
| | | minx: '' |
| | | }; |
| | | |
| | | constructor() {} |
| | | inputType = 'text'; |
| | | |
| | | constructor(private http: HttpClient) {} |
| | | |
| | | getData() { |
| | | this.http.getData(this.id, res => { |
| | | this.data = res; |
| | | if (this.data.type === 1) { |
| | | this.inputType = 'text'; |
| | | } else { |
| | | this.inputType = 'number'; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | ngOnInit(): void { |
| | | this.getData(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <ion-item *ngIf = 'data !== undefined'> |
| | | <ion-label>{{data.name}}</ion-label> |
| | | <ion-select *ngIf="data.dataList !== undefined" multiple="true" cancelText="取消" okText="确定"> |
| | | <ng-container *ngFor="let item of data.dataList"> |
| | | <ion-option value="item.id" >{{item.vel}}</ion-option> |
| | | </ng-container> |
| | | </ion-select> |
| | | </ion-item> |
New file |
| | |
| | | import { Component, Input } from '@angular/core'; |
| | | import { HttpClient } from 'kl/core/services/httpclient'; |
| | | |
| | | /** |
| | | * Generated class for the InputComponent component. |
| | | * |
| | | * See https://angular.io/docs/ts/latest/api/core/index/ComponentMetadata-class.html |
| | | * for more info on Angular Components. |
| | | */ |
| | | @Component({ |
| | | selector: 'test-select', |
| | | templateUrl: 'select.html' |
| | | }) |
| | | export class SelectComponent { |
| | | |
| | | @Input() |
| | | id = ''; |
| | | |
| | | data: any = { |
| | | id: '0', |
| | | name: 'err', |
| | | type: 1, |
| | | max: '', |
| | | minx: '', |
| | | dataList: [ |
| | | {id: '1', vel: 'err'}, |
| | | {id: '1', vel: 'err'}, |
| | | {id: '1', vel: 'err'} |
| | | ] |
| | | }; |
| | | |
| | | |
| | | constructor(private http: HttpClient) {} |
| | | |
| | | getData() { |
| | | this.http.getData(this.id, res => { |
| | | this.data = res; |
| | | console.log(this.data); |
| | | }); |
| | | } |
| | | |
| | | ngOnInit(): void { |
| | | this.getData(); |
| | | } |
| | | |
| | | } |
| | |
| | | <ion-header> |
| | | |
| | | <ion-navbar> |
| | | <ion-title>login</ion-title> |
| | | <ion-title>home</ion-title> |
| | | </ion-navbar> |
| | | |
| | | </ion-header> |
| | | |
| | | |
| | | <ion-content padding> |
| | | <ion-grid> |
| | | <ion-row> |
| | | <ion-item> |
| | | <ion-input type="number" max="1" placeholder="单行文本1"></ion-input> |
| | | </ion-item> |
| | | </ion-row> |
| | | <ion-row> |
| | | <ion-item> |
| | | <ion-label fixed>单行文本2:</ion-label> |
| | | <ion-input type="text" value=""></ion-input> |
| | | </ion-item> |
| | | </ion-row> |
| | | <ion-row> |
| | | <ion-label fixed>搜索:</ion-label> |
| | | <ion-searchbar ></ion-searchbar> |
| | | </ion-row> |
| | | <ion-row> |
| | | <ion-item> |
| | | <ion-label>多选1</ion-label> |
| | | <ion-checkbox color="dark" checked="true"></ion-checkbox> |
| | | </ion-item> |
| | | <ion-item> |
| | | <ion-label>多选2</ion-label> |
| | | <ion-checkbox ></ion-checkbox> |
| | | </ion-item> |
| | | </ion-row> |
| | | <ion-row> |
| | | <ion-item> |
| | | <ion-label>时间</ion-label> |
| | | <ion-datetime displayFormat="YYYY/MM/DD" ></ion-datetime> |
| | | </ion-item> |
| | | </ion-row> |
| | | <ion-list> |
| | | <button ion-item (click)="go()"> |
| | | row1 |
| | | </button> |
| | | <ion-list> |
| | | <test-input [id]='1'></test-input> |
| | | <test-input [id]='2'></test-input> |
| | | <test-select [id]='3'></test-select> |
| | | <test-checkbox [id]='4'></test-checkbox> |
| | | </ion-list> |
| | | |
| | | |
| | | |
| | | <ion-item> |
| | | <ion-label>下拉(多选)1</ion-label> |
| | | <ion-select multiple="true" cancelText="Nah" okText="Okay!"> |
| | | <ion-option value="bacon" selected="true">Bacon</ion-option> |
| | | <ion-option value="olives">Black Olives</ion-option> |
| | | <ion-option value="xcheese" selected="true">Extra Cheese</ion-option> |
| | | <ion-option value="peppers">Green Peppers</ion-option> |
| | | <ion-option value="mushrooms">Mushrooms</ion-option> |
| | | <ion-option value="onions">Onions</ion-option> |
| | | <ion-option value="pepperoni">Pepperoni</ion-option> |
| | | <ion-option value="pineapple">Pineapple</ion-option> |
| | | <ion-option value="sausage">Sausage</ion-option> |
| | | <ion-option value="Spinach">Spinach</ion-option> |
| | | </ion-select> |
| | | </ion-item> |
| | | <ion-row> |
| | | <ion-item> |
| | | <ion-label>多行文本</ion-label> |
| | | <ion-textarea autoresize="100"></ion-textarea> |
| | | </ion-item> |
| | | </ion-row> |
| | | </ion-grid> |
| | | </ion-content> |
| | | </ion-content> |
| | |
| | | import { NgModule } from '@angular/core'; |
| | | import { IonicPageModule } from 'ionic-angular'; |
| | | import { HomePage } from './home'; |
| | | |
| | | import { ComponentsModule } from '../../access/components/components.module'; |
| | | @NgModule({ |
| | | declarations: [ |
| | | HomePage, |
| | | ], |
| | | imports: [ |
| | | ComponentsModule, |
| | | IonicPageModule.forChild(HomePage), |
| | | ], |
| | | }) |
| | |
| | | import { Component } from '@angular/core'; |
| | | import { IonicPage, NavController, NavParams } from 'ionic-angular'; |
| | | |
| | | |
| | | @IonicPage({ |
| | | name: 'home' |
| | | }) |
| | |
| | | }) |
| | | export class HomePage { |
| | | |
| | | constructor(public navCtrl: NavController, public navParams: NavParams) { |
| | | } |
| | | constructor(public navCtrl: NavController, public navParams: NavParams) {} |
| | | |
| | | |
| | | ionViewDidLoad() { |
| | |
| | | import { IonicPageModule } from 'ionic-angular'; |
| | | import { TabsPage } from './tabs'; |
| | | |
| | | |
| | | |
| | | @NgModule({ |
| | | declarations: [ |
| | | TabsPage, |
| | |
| | | imports: [ |
| | | IonicPageModule.forChild(TabsPage), |
| | | ], |
| | | exports: [] |
| | | }) |
| | | export class TabsPageModule { } |