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:
11
.gitignore
vendored
11
.gitignore
vendored
@@ -69,6 +69,15 @@ nativescript-core/css/system-classes.js*
|
|||||||
!nativescript-core/build/**/*.*
|
!nativescript-core/build/**/*.*
|
||||||
|
|
||||||
#generated by api-extractor
|
#generated by api-extractor
|
||||||
nativescript-core/nativescript-core.d.ts
|
nativescript-core/nativescript-core.d.ts
|
||||||
|
|
||||||
.vs/
|
.vs/
|
||||||
|
e2e/
|
||||||
|
!e2e/animation
|
||||||
|
!e2e/config
|
||||||
|
!e2e/cuteness.io
|
||||||
|
!e2e/file-qualifiers
|
||||||
|
!e2e/modal-navigation
|
||||||
|
!e2e/nested-frame-navigation
|
||||||
|
!e2e/scoped-packages
|
||||||
|
!e2e/ui-tests-app
|
||||||
@@ -2336,6 +2336,8 @@ export class TabStrip extends View {
|
|||||||
|
|
||||||
// @public
|
// @public
|
||||||
export class TabStripItem extends View {
|
export class TabStripItem extends View {
|
||||||
|
iconClass: string;
|
||||||
|
|
||||||
iconSource: string;
|
iconSource: string;
|
||||||
|
|
||||||
image: Image;
|
image: Image;
|
||||||
|
|||||||
@@ -16,6 +16,11 @@ export class TabStripItem extends View {
|
|||||||
*/
|
*/
|
||||||
title: string;
|
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.
|
* 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 _title: string;
|
||||||
private _iconSource: string;
|
private _iconSource: string;
|
||||||
|
private _iconClass: string;
|
||||||
|
|
||||||
private _highlightedHandler: () => void;
|
private _highlightedHandler: () => void;
|
||||||
private _normalHandler: () => 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 {
|
get iconSource(): string {
|
||||||
if (this.isLoaded) {
|
if (this.isLoaded) {
|
||||||
return this.image.src;
|
return this.image.src;
|
||||||
@@ -79,6 +96,7 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
|
|||||||
if (!this.image) {
|
if (!this.image) {
|
||||||
const image = new Image();
|
const image = new Image();
|
||||||
image.src = this.iconSource;
|
image.src = this.iconSource;
|
||||||
|
image.className = this.iconClass;
|
||||||
this.image = image;
|
this.image = image;
|
||||||
this._addView(this.image);
|
this._addView(this.image);
|
||||||
}
|
}
|
||||||
@@ -176,6 +194,7 @@ export class TabStripItem extends View implements TabStripItemDefinition, AddChi
|
|||||||
if (value instanceof Image) {
|
if (value instanceof Image) {
|
||||||
this.image = <Image>value;
|
this.image = <Image>value;
|
||||||
this.iconSource = (<Image>value).src;
|
this.iconSource = (<Image>value).src;
|
||||||
|
this.iconClass = (<Image>value).className;
|
||||||
this._addView(value);
|
this._addView(value);
|
||||||
// selectedIndexProperty.coerce(this);
|
// selectedIndexProperty.coerce(this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user