mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
test(angular): simple ng tabs test
This commit is contained in:
@ -11,8 +11,6 @@ export class Tabs {
|
|||||||
|
|
||||||
@HostListener('ionTabbarClick', ['$event'])
|
@HostListener('ionTabbarClick', ['$event'])
|
||||||
ionTabbarClick(ev: UIEvent) {
|
ionTabbarClick(ev: UIEvent) {
|
||||||
console.log('ionTabbarClick', ev);
|
|
||||||
|
|
||||||
const tabElm: HTMLIonTabElement = ev.detail as any;
|
const tabElm: HTMLIonTabElement = ev.detail as any;
|
||||||
if (tabElm && tabElm.href) {
|
if (tabElm && tabElm.href) {
|
||||||
console.log('tabElm', tabElm.href);
|
console.log('tabElm', tabElm.href);
|
||||||
|
@ -3,26 +3,27 @@ import { Routes, RouterModule } from '@angular/router';
|
|||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
{ path: '', redirectTo: '/home', pathMatch: 'full' },
|
||||||
{ path: 'basic-inputs', loadChildren: 'app/basic-inputs-page/basic-inputs-page.module#BasicInputsPageModule' },
|
{ path: 'basic-inputs', loadChildren: './basic-inputs-page/basic-inputs-page.module#BasicInputsPageModule' },
|
||||||
{ path: 'show-hide-when', loadChildren: 'app/show-hide-when/show-hide-when.module#ShowHideWhenModule' },
|
{ path: 'show-hide-when', loadChildren: './show-hide-when/show-hide-when.module#ShowHideWhenModule' },
|
||||||
{ path: 'form-sample', loadChildren: 'app/form-sample-page/form-sample-page.module#FormSamplePageModule' },
|
{ path: 'form-sample', loadChildren: './form-sample-page/form-sample-page.module#FormSamplePageModule' },
|
||||||
{ path: 'group-inputs', loadChildren: 'app/group-inputs-page/group-inputs-page.module#GroupInputsPageModule' },
|
{ path: 'group-inputs', loadChildren: './group-inputs-page/group-inputs-page.module#GroupInputsPageModule' },
|
||||||
{ path: 'home', loadChildren: 'app/home-page/home-page.module#HomePageModule' },
|
{ path: 'home', loadChildren: './home-page/home-page.module#HomePageModule' },
|
||||||
{ path: 'alert', loadChildren: 'app/alert/alert.module#AlertModule' },
|
{ path: 'alert', loadChildren: './alert/alert.module#AlertModule' },
|
||||||
{ path: 'actionSheet', loadChildren: 'app/action-sheet/action-sheet.module#ActionSheetModule' },
|
{ path: 'actionSheet', loadChildren: './action-sheet/action-sheet.module#ActionSheetModule' },
|
||||||
{ path: 'badge', loadChildren: 'app/badge/badge.module#BadgeModule' },
|
{ path: 'badge', loadChildren: './badge/badge.module#BadgeModule' },
|
||||||
{ path: 'card', loadChildren: 'app/card/card.module#CardModule' },
|
{ path: 'card', loadChildren: './card/card.module#CardModule' },
|
||||||
{ path: 'content', loadChildren: 'app/content/content.module#ContentModule' },
|
{ path: 'content', loadChildren: './content/content.module#ContentModule' },
|
||||||
{ path: 'toast', loadChildren: 'app/toast/toast.module#ToastModule' },
|
{ path: 'toast', loadChildren: './toast/toast.module#ToastModule' },
|
||||||
{ path: 'loading', loadChildren: 'app/loading/loading.module#LoadingModule' },
|
{ path: 'loading', loadChildren: './loading/loading.module#LoadingModule' },
|
||||||
{ path: 'modal', loadChildren: 'app/modal/modal.module#ModalModule' },
|
{ path: 'modal', loadChildren: './modal/modal.module#ModalModule' },
|
||||||
{ path: 'popover', loadChildren: 'app/popover/popover.module#PopoverModule' },
|
{ path: 'popover', loadChildren: './popover/popover.module#PopoverModule' },
|
||||||
{ path: 'segment', loadChildren: 'app/segment/segment.module#SegmentModule' },
|
{ path: 'segment', loadChildren: './segment/segment.module#SegmentModule' },
|
||||||
{ path: 'virtual-scroll', loadChildren: 'app/virtual-scroll/virtual-scroll.module#VirtualScrollModule' },
|
{ path: 'virtual-scroll', loadChildren: './virtual-scroll/virtual-scroll.module#VirtualScrollModule' },
|
||||||
|
|
||||||
{ path: 'no-routing-nav', loadChildren: 'app/no-routing-nav/no-routing-nav.module#NoRoutingNavModule' },
|
{ path: 'no-routing-nav', loadChildren: './no-routing-nav/no-routing-nav.module#NoRoutingNavModule' },
|
||||||
{ path: 'simple-nav', loadChildren: 'app/simple-nav/simple-nav.module#SimpleNavModule' },
|
{ path: 'simple-nav', loadChildren: './simple-nav/simple-nav.module#SimpleNavModule' },
|
||||||
{ path: 'static-tabs', loadChildren: 'app/static-tabs/tabs.module#TabsModule' },
|
{ path: 'simple-tabs', loadChildren: './simple-tabs/tabs.module#TabsModule' },
|
||||||
|
{ path: 'static-tabs', loadChildren: './static-tabs/tabs.module#TabsModule' },
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -49,6 +49,20 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="simple-nav/page-one">Simple Nav</a>
|
<a href="simple-nav/page-one">Simple Nav</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="simple-tabs">Simple Tabs</a>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a [routerLink]="['/simple-tabs', 'tabs', { outlets: { tab1: ['mustang'] } }]">Tab 1</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a [routerLink]="['/simple-tabs', 'tabs', { outlets: { tab2: ['camaro'] } }]">Tab 2</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a [routerLink]="['/simple-tabs', 'tabs', { outlets: { tab3: ['charger'] } }]">Tab 3</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="static-tabs">Static Tabs</a>
|
<a href="static-tabs">Static Tabs</a>
|
||||||
</li>
|
</li>
|
||||||
|
15
angular/test/nav/src/app/simple-tabs/camaro/camaro-routing.module.ts
Executable file
15
angular/test/nav/src/app/simple-tabs/camaro/camaro-routing.module.ts
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
import { CamaroPage } from './camaro.page';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{ path: '', component: CamaroPage, outlet: 'tab2' }
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes), IonicModule],
|
||||||
|
exports: [RouterModule, IonicModule]
|
||||||
|
})
|
||||||
|
export class CamaroPageRoutingModule { }
|
19
angular/test/nav/src/app/simple-tabs/camaro/camaro.module.ts
Executable file
19
angular/test/nav/src/app/simple-tabs/camaro/camaro.module.ts
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
import { CamaroPage } from './camaro.page';
|
||||||
|
import { CamaroPageRoutingModule } from './camaro-routing.module';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
IonicModule,
|
||||||
|
CamaroPageRoutingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
CamaroPage
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class CamaroModule {}
|
17
angular/test/nav/src/app/simple-tabs/camaro/camaro.page.ts
Executable file
17
angular/test/nav/src/app/simple-tabs/camaro/camaro.page.ts
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'camaro-page',
|
||||||
|
template: `
|
||||||
|
<ion-header>
|
||||||
|
<ion-toolbar>
|
||||||
|
<ion-title>Camaro</ion-title>
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-header>
|
||||||
|
<ion-content padding>
|
||||||
|
Camaro
|
||||||
|
</ion-content>
|
||||||
|
`
|
||||||
|
})
|
||||||
|
export class CamaroPage {}
|
15
angular/test/nav/src/app/simple-tabs/charger/charger-routing.module.ts
Executable file
15
angular/test/nav/src/app/simple-tabs/charger/charger-routing.module.ts
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
import { ChargerPage } from './charger.page';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{ path: '', component: ChargerPage, outlet: 'tab3' }
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes), IonicModule],
|
||||||
|
exports: [RouterModule, IonicModule]
|
||||||
|
})
|
||||||
|
export class ChargerPageRoutingModule { }
|
19
angular/test/nav/src/app/simple-tabs/charger/charger.module.ts
Executable file
19
angular/test/nav/src/app/simple-tabs/charger/charger.module.ts
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
import { ChargerPage } from './charger.page';
|
||||||
|
import { ChargerPageRoutingModule } from './charger-routing.module';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
IonicModule,
|
||||||
|
ChargerPageRoutingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
ChargerPage
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class ChargerModule {}
|
17
angular/test/nav/src/app/simple-tabs/charger/charger.page.ts
Executable file
17
angular/test/nav/src/app/simple-tabs/charger/charger.page.ts
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'charger-page',
|
||||||
|
template: `
|
||||||
|
<ion-header>
|
||||||
|
<ion-toolbar>
|
||||||
|
<ion-title>Charger</ion-title>
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-header>
|
||||||
|
<ion-content padding>
|
||||||
|
Charger
|
||||||
|
</ion-content>
|
||||||
|
`
|
||||||
|
})
|
||||||
|
export class ChargerPage {}
|
15
angular/test/nav/src/app/simple-tabs/mustang/mustang-routing.module.ts
Executable file
15
angular/test/nav/src/app/simple-tabs/mustang/mustang-routing.module.ts
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
import { MustangPage } from './mustang.page';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{ path: '', component: MustangPage, outlet: 'tab1' }
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes), IonicModule],
|
||||||
|
exports: [RouterModule, IonicModule]
|
||||||
|
})
|
||||||
|
export class MustangPageRoutingModule { }
|
19
angular/test/nav/src/app/simple-tabs/mustang/mustang.module.ts
Executable file
19
angular/test/nav/src/app/simple-tabs/mustang/mustang.module.ts
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
import { MustangPage } from './mustang.page';
|
||||||
|
import { MustangPageRoutingModule } from './mustang-routing.module';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
IonicModule,
|
||||||
|
MustangPageRoutingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
MustangPage
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class MustangModule {}
|
17
angular/test/nav/src/app/simple-tabs/mustang/mustang.page.ts
Executable file
17
angular/test/nav/src/app/simple-tabs/mustang/mustang.page.ts
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'mustang-page',
|
||||||
|
template: `
|
||||||
|
<ion-header>
|
||||||
|
<ion-toolbar>
|
||||||
|
<ion-title>Mustang</ion-title>
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-header>
|
||||||
|
<ion-content padding>
|
||||||
|
Mustang
|
||||||
|
</ion-content>
|
||||||
|
`
|
||||||
|
})
|
||||||
|
export class MustangPage {}
|
40
angular/test/nav/src/app/simple-tabs/tabs-routing.module.ts
Executable file
40
angular/test/nav/src/app/simple-tabs/tabs-routing.module.ts
Executable file
@ -0,0 +1,40 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
import { TabsPageComponent } from './tabs.component';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{
|
||||||
|
path: 'tabs',
|
||||||
|
component: TabsPageComponent,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: 'mustang',
|
||||||
|
outlet: 'tab1',
|
||||||
|
loadChildren: 'app/simple-tabs/mustang/mustang.module#MustangModule'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'camaro',
|
||||||
|
outlet: 'tab2',
|
||||||
|
loadChildren: 'app/simple-tabs/camaro/camaro.module#CamaroModule'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'charger',
|
||||||
|
outlet: 'tab3',
|
||||||
|
loadChildren: 'app/simple-tabs/charger/charger.module#ChargerModule'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
RouterModule.forChild(routes)
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
RouterModule
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class TabsRoutingModule { }
|
7
angular/test/nav/src/app/simple-tabs/tabs.component.ts
Executable file
7
angular/test/nav/src/app/simple-tabs/tabs.component.ts
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'tabs-root',
|
||||||
|
templateUrl: 'tabs.html'
|
||||||
|
})
|
||||||
|
export class TabsPageComponent {}
|
19
angular/test/nav/src/app/simple-tabs/tabs.html
Normal file
19
angular/test/nav/src/app/simple-tabs/tabs.html
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<ion-app>
|
||||||
|
|
||||||
|
<ion-tabs>
|
||||||
|
|
||||||
|
<ion-tab title="Tab 1" icon="home">
|
||||||
|
<ion-router-outlet name="tab1"></ion-router-outlet>
|
||||||
|
</ion-tab>
|
||||||
|
|
||||||
|
<ion-tab title="Tab 2" icon="heart">
|
||||||
|
<ion-router-outlet name="tab2"></ion-router-outlet>
|
||||||
|
</ion-tab>
|
||||||
|
|
||||||
|
<ion-tab title="Tab 3" icon="star">
|
||||||
|
<ion-router-outlet name="tab3"></ion-router-outlet>
|
||||||
|
</ion-tab>
|
||||||
|
|
||||||
|
</ion-tabs>
|
||||||
|
|
||||||
|
</ion-app>
|
19
angular/test/nav/src/app/simple-tabs/tabs.module.ts
Executable file
19
angular/test/nav/src/app/simple-tabs/tabs.module.ts
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
|
import { IonicModule } from '@ionic/angular';
|
||||||
|
import { TabsPageComponent } from './tabs.component';
|
||||||
|
import { TabsRoutingModule } from './tabs-routing.module';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
IonicModule,
|
||||||
|
TabsRoutingModule,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
TabsPageComponent,
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class TabsModule {}
|
Reference in New Issue
Block a user