mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 14:01:20 +08:00
chore(tabs): update subpages to work w/ @Component
This commit is contained in:
@ -51,8 +51,9 @@ export class TabButton extends Ion {
|
|||||||
this.hasBadge = !!this.tab.tabBadge;
|
this.hasBadge = !!this.tab.tabBadge;
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('click')
|
@HostListener('click', ['$event'])
|
||||||
private onClick() {
|
private onClick(ev: UIEvent) {
|
||||||
this.ionSelect.emit(this.tab);
|
this.ionSelect.emit(this.tab);
|
||||||
|
ev.preventDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,9 @@ import {Config} from '../../config/config';
|
|||||||
import {isTrueProperty} from '../../util/util';
|
import {isTrueProperty} from '../../util/util';
|
||||||
import {Keyboard} from '../../util/keyboard';
|
import {Keyboard} from '../../util/keyboard';
|
||||||
import {NavController, NavOptions} from '../nav/nav-controller';
|
import {NavController, NavOptions} from '../nav/nav-controller';
|
||||||
import {ViewController} from '../nav/view-controller';
|
|
||||||
import {Tabs} from './tabs';
|
|
||||||
import {TabButton} from './tab-button';
|
import {TabButton} from './tab-button';
|
||||||
|
import {Tabs} from './tabs';
|
||||||
|
import {ViewController} from '../nav/view-controller';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -291,8 +291,12 @@ export class Tab extends NavController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
super.loadPage(viewCtrl, navbarContainerRef, opts, () => {
|
super.loadPage(viewCtrl, navbarContainerRef, opts, () => {
|
||||||
if (viewCtrl.instance) {
|
if (isTabSubPage) {
|
||||||
viewCtrl.instance._tabSubPage = isTabSubPage;
|
// add the .tab-subpage css class to tabs pages that should act like subpages
|
||||||
|
let pageEleRef = viewCtrl.pageRef();
|
||||||
|
if (pageEleRef) {
|
||||||
|
this._renderer.setElementClass(pageEleRef.nativeElement, 'tab-subpage', true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
@ -80,6 +80,7 @@ tabbar {
|
|||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
background: none;
|
background: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
@ -2,14 +2,14 @@ import {Component, Directive, ElementRef, Optional, Host, forwardRef, ViewContai
|
|||||||
|
|
||||||
import {App} from '../app/app';
|
import {App} from '../app/app';
|
||||||
import {Config} from '../../config/config';
|
import {Config} from '../../config/config';
|
||||||
|
import {Ion} from '../ion';
|
||||||
|
import {isBlank, isTrueProperty} from '../../util/util';
|
||||||
|
import {NavController} from '../nav/nav-controller';
|
||||||
|
import {Platform} from '../../platform/platform';
|
||||||
import {Tab} from './tab';
|
import {Tab} from './tab';
|
||||||
import {TabButton} from './tab-button';
|
import {TabButton} from './tab-button';
|
||||||
import {TabHighlight} from './tab-highlight';
|
import {TabHighlight} from './tab-highlight';
|
||||||
import {Ion} from '../ion';
|
|
||||||
import {Platform} from '../../platform/platform';
|
|
||||||
import {NavController} from '../nav/nav-controller';
|
|
||||||
import {ViewController} from '../nav/view-controller';
|
import {ViewController} from '../nav/view-controller';
|
||||||
import {isBlank, isTrueProperty} from '../../util/util';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -138,7 +138,7 @@ import {isBlank, isTrueProperty} from '../../util/util';
|
|||||||
'</ion-navbar-section>' +
|
'</ion-navbar-section>' +
|
||||||
'<ion-tabbar-section>' +
|
'<ion-tabbar-section>' +
|
||||||
'<tabbar role="tablist">' +
|
'<tabbar role="tablist">' +
|
||||||
'<a *ngFor="let t of _tabs" [tab]="t" class="tab-button" [class.tab-disabled]="!t.enabled" [class.tab-hidden]="!t.show" role="tab">' +
|
'<a *ngFor="let t of _tabs" [tab]="t" class="tab-button" [class.tab-disabled]="!t.enabled" [class.tab-hidden]="!t.show" role="tab" href="#">' +
|
||||||
'<ion-icon *ngIf="t.tabIcon" [name]="t.tabIcon" [isActive]="t.isSelected" class="tab-button-icon"></ion-icon>' +
|
'<ion-icon *ngIf="t.tabIcon" [name]="t.tabIcon" [isActive]="t.isSelected" class="tab-button-icon"></ion-icon>' +
|
||||||
'<span *ngIf="t.tabTitle" class="tab-button-text">{{t.tabTitle}}</span>' +
|
'<span *ngIf="t.tabTitle" class="tab-button-text">{{t.tabTitle}}</span>' +
|
||||||
'<ion-badge *ngIf="t.tabBadge" class="tab-badge" [ngClass]="\'badge-\' + t.tabBadgeStyle">{{t.tabBadge}}</ion-badge>' +
|
'<ion-badge *ngIf="t.tabBadge" class="tab-badge" [ngClass]="\'badge-\' + t.tabBadgeStyle">{{t.tabBadge}}</ion-badge>' +
|
||||||
|
@ -411,11 +411,15 @@ class Tab3Page1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Component({})
|
@Component({
|
||||||
@Routes([
|
template: '<ion-nav [root]="root"></ion-nav>'
|
||||||
{ path: '/', component: SignIn },
|
})
|
||||||
{ path: '/tabs', component: TabsPage },
|
// @Routes([
|
||||||
])
|
// { path: '/', component: SignIn },
|
||||||
class E2EApp {}
|
// { path: '/tabs', component: TabsPage },
|
||||||
|
// ])
|
||||||
|
class E2EApp {
|
||||||
|
root = SignIn;
|
||||||
|
}
|
||||||
|
|
||||||
ionicBootstrap(E2EApp);
|
ionicBootstrap(E2EApp);
|
||||||
|
@ -39,7 +39,6 @@ export function ionicBootstrap(appRootComponent: any, customProviders?: Array<an
|
|||||||
|
|
||||||
|
|
||||||
export function ionicPostBootstrap(ngComponentRef: ComponentRef<any>): ComponentRef<any> {
|
export function ionicPostBootstrap(ngComponentRef: ComponentRef<any>): ComponentRef<any> {
|
||||||
//ngComponentRef.injector.get(TapClick);
|
|
||||||
let app: App = ngComponentRef.injector.get(App);
|
let app: App = ngComponentRef.injector.get(App);
|
||||||
app.setAppInjector(ngComponentRef.injector);
|
app.setAppInjector(ngComponentRef.injector);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user