mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
fix(button): check for icon and add css after content checked
fixes #6662
This commit is contained in:
@ -210,6 +210,14 @@ export class Button {
|
|||||||
this._assignCss(true);
|
this._assignCss(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
ngAfterContentChecked() {
|
||||||
|
this._readIcon(this._elementRef.nativeElement);
|
||||||
|
this._assignCss(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
@ -256,6 +264,9 @@ export class Button {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove any classes that are set already
|
||||||
|
this._setClass(this._icon, false);
|
||||||
|
|
||||||
if (nodes.length > 1) {
|
if (nodes.length > 1) {
|
||||||
if (nodes[0] === ICON && nodes[1] === TEXT) {
|
if (nodes[0] === ICON && nodes[1] === TEXT) {
|
||||||
this._icon = 'icon-left';
|
this._icon = 'icon-left';
|
||||||
|
@ -11,12 +11,25 @@ class E2EPage {
|
|||||||
items = [];
|
items = [];
|
||||||
shouldShow: boolean = true;
|
shouldShow: boolean = true;
|
||||||
|
|
||||||
|
moreText: string = "Dynamic More";
|
||||||
|
archiveText: string = "Dynamic Archive";
|
||||||
|
|
||||||
constructor(private app: App, private nav: NavController) {
|
constructor(private app: App, private nav: NavController) {
|
||||||
for (let x = 0; x < 20; x++) {
|
for (let x = 0; x < 5; x++) {
|
||||||
this.items.push(x);
|
this.items.push(x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeDynamic() {
|
||||||
|
if (this.moreText.includes("Dynamic")) {
|
||||||
|
this.moreText = "Changed More";
|
||||||
|
this.archiveText = "Changed Archive";
|
||||||
|
} else {
|
||||||
|
this.moreText = "Dynamic More";
|
||||||
|
this.archiveText = "Dynamic Archive";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
closeOpened() {
|
closeOpened() {
|
||||||
this.list.closeSlidingItems();
|
this.list.closeSlidingItems();
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,38 @@
|
|||||||
<button danger (click)="del(item)">
|
<button danger (click)="del(item)">
|
||||||
<ion-icon name="trash"></ion-icon>Delete
|
<ion-icon name="trash"></ion-icon>Delete
|
||||||
</button>
|
</button>
|
||||||
|
</ion-item-options>
|
||||||
|
</ion-item-sliding>
|
||||||
|
|
||||||
|
<ion-item-sliding #item>
|
||||||
|
<ion-item>
|
||||||
|
One Line, dynamic option
|
||||||
|
</ion-item>
|
||||||
|
<ion-item-options>
|
||||||
|
<button primary>
|
||||||
|
<ion-icon name="more"></ion-icon>
|
||||||
|
{{ moreText }}
|
||||||
|
</button>
|
||||||
|
<button secondary (click)="archive(item)">
|
||||||
|
<ion-icon name="archive"></ion-icon>
|
||||||
|
{{ archiveText }}
|
||||||
|
</button>
|
||||||
|
</ion-item-options>
|
||||||
|
</ion-item-sliding>
|
||||||
|
|
||||||
|
<ion-item-sliding #item>
|
||||||
|
<ion-item>
|
||||||
|
One Line, dynamic icon-left option
|
||||||
|
</ion-item>
|
||||||
|
<ion-item-options icon-left>
|
||||||
|
<button primary>
|
||||||
|
<ion-icon name="more"></ion-icon>
|
||||||
|
{{ moreText }}
|
||||||
|
</button>
|
||||||
|
<button secondary (click)="archive(item)">
|
||||||
|
<ion-icon name="archive"></ion-icon>
|
||||||
|
{{ archiveText }}
|
||||||
|
</button>
|
||||||
</ion-item-options>
|
</ion-item-options>
|
||||||
</ion-item-sliding>
|
</ion-item-sliding>
|
||||||
|
|
||||||
@ -111,9 +142,10 @@
|
|||||||
|
|
||||||
</ion-list>
|
</ion-list>
|
||||||
|
|
||||||
<p>
|
<div padding>
|
||||||
<button (click)="closeOpened()">Close opened items</button>
|
<button block (click)="changeDynamic()">Change Dynamic Options</button>
|
||||||
</p>
|
<button block (click)="closeOpened()">Close Opened Items</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user