对于我们的 NativeScript Angular2 应用程序,我们需要底部对齐的选项卡。我们正在尝试通过 SegmentedBar 来实现这一点(因为我理解 tabviews 在 NativeScript-Angular2 应用程序中不能底部对齐)。如何在分段栏标题中实现字体真棒图标?我尝试将此 unicode 保存在 items 数组中,然后在 html 中分配一个很棒的字体类,但这不起作用。还有其他选择吗?
我的代码如下-segmentedbar.ts:
import { Component, ChangeDetectionStrategy } from "@angular/core";
import { SegmentedBarItem } from "ui/segmented-bar";
@Component({
moduleId: module.id,
selector: "maintab",
templateUrl: "./maintab.component.html",
changeDetection: ChangeDetectionStrategy.OnPush
})
export class MainTabComponent {
public myItems: Array;
public prop = "Item " + 0;
constructor() {
this.myItems = [];
for (let i = 1; i < 5; i++) {
let tmpSegmentedBar: SegmentedBarItem = <SegmentedBarItem>new SegmentedBarItem();
tmpSegmentedBar.title = "Tab " + i;
this.myItems.push(tmpSegmentedBar);
}
}
这是我的 segmentedbar.html
<StackLayout>
<StackLayout>
<!-- >> segmentedbar-basic-html -->
<Label [text]="prop" textWrap="true" vertical-align="center" class="h2 p-15 text-center"></Label>
<SegmentedBar class="m-5" #sb [items]="myItems" selectedIndex="0" (selectedIndexChange)="prop='Item '+ sb.selectedIndex"></SegmentedBar><!-- << segmentedbar-basic-html -->
</StackLayout>
</StackLayout>