mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Added iconClass property to TabStripItem (#8440)
* chore: ignore e2e folder's other subfolders * feat: added iconClass to tabStripItem
This commit is contained in:
@@ -16,6 +16,11 @@ export class TabStripItem extends View {
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the CSS class name of the icon in the tab strip entry.
|
||||
*/
|
||||
iconClass: string;
|
||||
|
||||
/**
|
||||
* Gets or sets the icon source of the tab strip entry.
|
||||
*/
|
||||
|
||||
@@ -30,6 +30,7 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
|
||||
|
||||
private _title: string;
|
||||
private _iconSource: string;
|
||||
private _iconClass: string;
|
||||
|
||||
private _highlightedHandler: () => void;
|
||||
private _normalHandler: () => void;
|
||||
@@ -59,6 +60,22 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
|
||||
}
|
||||
}
|
||||
|
||||
get iconClass(): string {
|
||||
if (this.isLoaded) {
|
||||
return this.image.className;
|
||||
}
|
||||
|
||||
return this._iconClass;
|
||||
}
|
||||
|
||||
set iconClass(value: string) {
|
||||
this._iconClass = value;
|
||||
|
||||
if (this.isLoaded) {
|
||||
this.image.className = value;
|
||||
}
|
||||
}
|
||||
|
||||
get iconSource(): string {
|
||||
if (this.isLoaded) {
|
||||
return this.image.src;
|
||||
@@ -79,6 +96,7 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
|
||||
if (!this.image) {
|
||||
const image = new Image();
|
||||
image.src = this.iconSource;
|
||||
image.className = this.iconClass;
|
||||
this.image = image;
|
||||
this._addView(this.image);
|
||||
}
|
||||
@@ -176,6 +194,7 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
|
||||
if (value instanceof Image) {
|
||||
this.image = <Image>value;
|
||||
this.iconSource = (<Image>value).src;
|
||||
this.iconClass = (<Image>value).className;
|
||||
this._addView(value);
|
||||
// selectedIndexProperty.coerce(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user