mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
@ -821,7 +821,7 @@ export class Tab {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export declare interface Tabs extends StencilComponents<'IonTabs'> {}
|
export declare interface Tabs extends StencilComponents<'IonTabs'> {}
|
||||||
@Component({ selector: 'ion-tabs', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '<ng-content></ng-content>', inputs: ['color', 'name', 'tabbarHidden', 'tabbarHighlight', 'tabbarLayout', 'tabbarPlacement', 'translucent', 'useRouter'] })
|
@Component({ selector: 'ion-tabs', changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: '<ng-content></ng-content>', inputs: ['mode', 'color', 'name', 'tabbarHidden', 'tabbarHighlight', 'tabbarLayout', 'tabbarPlacement', 'translucent', 'useRouter'] })
|
||||||
export class Tabs {
|
export class Tabs {
|
||||||
ionChange: EventEmitter<CustomEvent>;
|
ionChange: EventEmitter<CustomEvent>;
|
||||||
ionNavWillLoad: EventEmitter<CustomEvent>;
|
ionNavWillLoad: EventEmitter<CustomEvent>;
|
||||||
@ -831,7 +831,7 @@ export class Tabs {
|
|||||||
constructor(r: ElementRef) {
|
constructor(r: ElementRef) {
|
||||||
const el = r.nativeElement;
|
const el = r.nativeElement;
|
||||||
proxyMethods(this, el, ['select', 'setRouteId', 'getRouteId', 'getTab', 'getSelected']);
|
proxyMethods(this, el, ['select', 'setRouteId', 'getRouteId', 'getTab', 'getSelected']);
|
||||||
proxyInputs(this, el, ['color', 'name', 'tabbarHidden', 'tabbarHighlight', 'tabbarLayout', 'tabbarPlacement', 'translucent', 'useRouter']);
|
proxyInputs(this, el, ['mode', 'color', 'name', 'tabbarHidden', 'tabbarHighlight', 'tabbarLayout', 'tabbarPlacement', 'translucent', 'useRouter']);
|
||||||
proxyOutputs(this, el, ['ionChange', 'ionNavWillLoad', 'ionNavWillChange', 'ionNavDidChange']);
|
proxyOutputs(this, el, ['ionChange', 'ionNavWillLoad', 'ionNavWillChange', 'ionNavDidChange']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
core/src/components.d.ts
vendored
8
core/src/components.d.ts
vendored
@ -4595,6 +4595,10 @@ export namespace Components {
|
|||||||
*/
|
*/
|
||||||
'getTab': (tabOrIndex: string | number | HTMLIonTabElement) => Promise<HTMLIonTabElement | undefined>;
|
'getTab': (tabOrIndex: string | number | HTMLIonTabElement) => Promise<HTMLIonTabElement | undefined>;
|
||||||
/**
|
/**
|
||||||
|
* The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`.
|
||||||
|
*/
|
||||||
|
'mode': Mode;
|
||||||
|
/**
|
||||||
* A unique name for the tabs.
|
* A unique name for the tabs.
|
||||||
*/
|
*/
|
||||||
'name'?: string;
|
'name'?: string;
|
||||||
@ -4634,6 +4638,10 @@ export namespace Components {
|
|||||||
*/
|
*/
|
||||||
'color'?: Color;
|
'color'?: Color;
|
||||||
/**
|
/**
|
||||||
|
* The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`.
|
||||||
|
*/
|
||||||
|
'mode'?: Mode;
|
||||||
|
/**
|
||||||
* A unique name for the tabs.
|
* A unique name for the tabs.
|
||||||
*/
|
*/
|
||||||
'name'?: string;
|
'name'?: string;
|
||||||
|
@ -9,7 +9,7 @@ import { createColorClasses } from '../../utils/theme';
|
|||||||
ios: 'tabbar.ios.scss',
|
ios: 'tabbar.ios.scss',
|
||||||
md: 'tabbar.md.scss'
|
md: 'tabbar.md.scss'
|
||||||
},
|
},
|
||||||
shadow: true
|
scoped: true
|
||||||
})
|
})
|
||||||
export class Tabbar implements ComponentInterface {
|
export class Tabbar implements ComponentInterface {
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ The component is a container of individual [Tab](../Tab/) components.
|
|||||||
| Property | Attribute | Description | Type |
|
| Property | Attribute | Description | Type |
|
||||||
| ----------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
|
| ----------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
|
||||||
| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `Color` |
|
| `color` | `color` | The color to use from your application's color palette. Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`. For more information on colors, see [theming](/docs/theming/basics). | `Color` |
|
||||||
|
| `mode` | `mode` | The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`. | `Mode` |
|
||||||
| `name` | `name` | A unique name for the tabs. | `string` |
|
| `name` | `name` | A unique name for the tabs. | `string` |
|
||||||
| `tabbarHidden` | `tabbar-hidden` | If true, the tabbar will be hidden. Defaults to `false`. | `boolean` |
|
| `tabbarHidden` | `tabbar-hidden` | If true, the tabbar will be hidden. Defaults to `false`. | `boolean` |
|
||||||
| `tabbarHighlight` | `tabbar-highlight` | If true, show the tab highlight bar under the selected tab. | `boolean` |
|
| `tabbarHighlight` | `tabbar-highlight` | If true, show the tab highlight bar under the selected tab. | `boolean` |
|
||||||
|
@ -15,10 +15,21 @@
|
|||||||
z-index: $z-index-page-container;
|
z-index: $z-index-page-container;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tabs-inner {
|
ion-tabbar {
|
||||||
position: relative;
|
@include position(null, 0, 0, 0);
|
||||||
|
|
||||||
flex: 1;
|
display: none;
|
||||||
|
position: absolute;
|
||||||
contain: layout size style;
|
}
|
||||||
|
|
||||||
|
:host(.tabbar-visible.tabs-md)::slotted(ion-tab) {
|
||||||
|
bottom: 56px; // tabbar height (it's fixed!)
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.tabbar-visible.tabs-ios)::slotted(ion-tab) {
|
||||||
|
bottom: 50px; // tabbar height (it's fixed!)
|
||||||
|
}
|
||||||
|
|
||||||
|
:host(.tabbar-visible) ion-tabbar {
|
||||||
|
display: flex;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { Build, Component, Element, Event, EventEmitter, Listen, Method, Prop, State } from '@stencil/core';
|
import { Build, Component, Element, Event, EventEmitter, Listen, Method, Prop, State } from '@stencil/core';
|
||||||
|
|
||||||
import { Color, Config, IonicConfig, NavOutlet, RouteID, RouteWrite, TabbarLayout, TabbarPlacement } from '../../interface';
|
import { Color, Config, IonicConfig, Mode, NavOutlet, RouteID, RouteWrite, TabbarLayout, TabbarPlacement } from '../../interface';
|
||||||
import { createColorClasses } from '../../utils/theme';
|
import { createThemedClasses } from '../../utils/theme';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
tag: 'ion-tabs',
|
tag: 'ion-tabs',
|
||||||
styleUrl: 'tabs.scss',
|
styleUrl: 'tabs.scss',
|
||||||
shadow: true
|
scoped: true
|
||||||
})
|
})
|
||||||
export class Tabs implements NavOutlet {
|
export class Tabs implements NavOutlet {
|
||||||
|
|
||||||
@ -23,6 +23,12 @@ export class Tabs implements NavOutlet {
|
|||||||
@Prop({ context: 'config' }) config!: Config;
|
@Prop({ context: 'config' }) config!: Config;
|
||||||
@Prop({ context: 'document' }) doc!: Document;
|
@Prop({ context: 'document' }) doc!: Document;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The mode determines which platform styles to use.
|
||||||
|
* Possible values are: `"ios"` or `"md"`.
|
||||||
|
*/
|
||||||
|
@Prop() mode!: Mode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color to use from your application's color palette.
|
* The color to use from your application's color palette.
|
||||||
* Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
|
* Default options are: `"primary"`, `"secondary"`, `"tertiary"`, `"success"`, `"warning"`, `"danger"`, `"light"`, `"medium"`, and `"dark"`.
|
||||||
@ -103,7 +109,7 @@ export class Tabs implements NavOutlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidLoad() {
|
componentDidLoad() {
|
||||||
return this.initSelect();
|
this.initSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUnload() {
|
componentDidUnload() {
|
||||||
@ -293,29 +299,27 @@ export class Tabs implements NavOutlet {
|
|||||||
|
|
||||||
hostData() {
|
hostData() {
|
||||||
return {
|
return {
|
||||||
class: createColorClasses(this.color)
|
class: {
|
||||||
|
...createThemedClasses(this.mode, 'tabs'),
|
||||||
|
'tabbar-visible': !this.tabbarHidden
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return [
|
return (
|
||||||
<div class="tabs-inner">
|
<ion-tabbar
|
||||||
<slot></slot>
|
mode={this.mode}
|
||||||
</div>,
|
tabs={this.tabs.slice()}
|
||||||
|
color={this.color}
|
||||||
!this.tabbarHidden && (
|
selectedTab={this.selectedTab}
|
||||||
<ion-tabbar
|
highlight={this.tabbarHighlight}
|
||||||
tabs={this.tabs.slice()}
|
placement={this.tabbarPlacement}
|
||||||
color={this.color}
|
layout={this.tabbarLayout}
|
||||||
selectedTab={this.selectedTab}
|
translucent={this.translucent}
|
||||||
highlight={this.tabbarHighlight}
|
>
|
||||||
placement={this.tabbarPlacement}
|
</ion-tabbar>
|
||||||
layout={this.tabbarLayout}
|
);
|
||||||
translucent={this.translucent}
|
|
||||||
>
|
|
||||||
</ion-tabbar>
|
|
||||||
)
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
</ion-content>
|
</ion-content>
|
||||||
</ion-tab>
|
</ion-tab>
|
||||||
|
|
||||||
<ion-tab label="Schedule" icon="globe">
|
<ion-tab label="Schedule" icon="globe" badge="6" badge-color="danger">
|
||||||
<ion-header>
|
<ion-header>
|
||||||
<ion-toolbar>
|
<ion-toolbar>
|
||||||
<ion-title>Tab Two</ion-title>
|
<ion-title>Tab Two</ion-title>
|
||||||
|
Reference in New Issue
Block a user