mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00

BREAKING CHANGES: Colors should be passed in the `color` input on components, not added individually as an attribute on the component. For example: ``` <ion-tabs primary> ``` Becomes ``` <ion-tabs color=”primary”> ``` Or to bind an expression to color: ``` <ion-navbar [color]="barColor"> ... </ion-navbar> ``` ```ts @Component({ templateUrl: 'build/pages/about/about.html' }) export class AboutPage { barColor: string; constructor(private nav: NavController, platform: Platform) { this.barColor = platform.is('android') ? 'primary' : 'light'; } } ``` Reason for this change: It was difficult to dynamically add colors to components, especially if the name of the color attribute was unknown in the template. This change keeps the css flat since we aren’t chaining color attributes on components and instead we assign a class to the component which includes the color’s name. This allows you to easily toggle a component between multiple colors. Speeds up performance because we are no longer reading through all of the attributes to grab the color ones. references #7467 closes #7087 closes #7401 closes #7523
76 lines
2.1 KiB
HTML
76 lines
2.1 KiB
HTML
<ion-header>
|
|
|
|
<ion-navbar no-border-bottom>
|
|
<ion-title>Segment</ion-title>
|
|
</ion-navbar>
|
|
|
|
<ion-toolbar no-border-top>
|
|
<ion-segment [(ngModel)]="appType">
|
|
<ion-segment-button value="Paid">
|
|
Paid
|
|
</ion-segment-button>
|
|
<ion-segment-button value="Free">
|
|
Free
|
|
</ion-segment-button>
|
|
<ion-segment-button value="Top">
|
|
Top
|
|
</ion-segment-button>
|
|
</ion-segment>
|
|
</ion-toolbar>
|
|
|
|
</ion-header>
|
|
|
|
<ion-content class="outer-content">
|
|
<ion-list>
|
|
<ion-list-header>{{ appType }}</ion-list-header>
|
|
<ion-item *ngFor="let item of getItems(appType)">
|
|
{{ item.name }}
|
|
<button ion-button outline item-right>{{ item.price }}</button>
|
|
</ion-item>
|
|
</ion-list>
|
|
|
|
<ion-card>
|
|
<ion-card-header>
|
|
{{ safari }}
|
|
</ion-card-header>
|
|
<ion-card-content>
|
|
<ion-segment [(ngModel)]="safari" color="dark">
|
|
<ion-segment-button value="Bookmarks">
|
|
<ion-icon name="book"></ion-icon>
|
|
</ion-segment-button>
|
|
<ion-segment-button value="Reading List">
|
|
<ion-icon ios="ios-glasses-outline" md="md-glasses"></ion-icon>
|
|
</ion-segment-button>
|
|
<ion-segment-button value="Shared Links">
|
|
<ion-icon ios="ios-at-outline" md="md-at"></ion-icon>
|
|
</ion-segment-button>
|
|
</ion-segment>
|
|
<ion-list style="margin: 0" inset>
|
|
<button ion-item *ngFor="let sItem of getSafariItems(safari)">
|
|
<ion-icon item-left [name]="sItem.icon" color="primary"></ion-icon>
|
|
{{ sItem.name }}
|
|
</button>
|
|
</ion-list>
|
|
</ion-card-content>
|
|
</ion-card>
|
|
</ion-content>
|
|
|
|
<ion-footer>
|
|
<ion-toolbar no-border-bottom>
|
|
<ion-title>
|
|
Weather: {{ weather == 'sunny' ? '96' : '77' }}°
|
|
<ion-icon [name]="weather" color="danger"></ion-icon>
|
|
</ion-title>
|
|
</ion-toolbar>
|
|
<ion-toolbar no-border-top no-border-bottom>
|
|
<ion-segment [(ngModel)]="weather" color="danger">
|
|
<ion-segment-button value="sunny">
|
|
Sunny
|
|
</ion-segment-button>
|
|
<ion-segment-button value="rainy" checked>
|
|
Rainy
|
|
</ion-segment-button>
|
|
</ion-segment>
|
|
</ion-toolbar>
|
|
</ion-footer>
|