0
移動到另一個標籤時加載此mainactivity頁面,第一次當改變操作欄標題的文本,它加載 第三標籤頁操作欄文本。如何從一個選項卡nativescript
我需要基於點擊標籤加載操作欄文本。
例如:當我點擊第二個標籤意味着第二個標籤操作欄有 來獲得觸發器。
main.activity.html:
<ActionBar title="MainActivity" class="action-bar">
</ActionBar>
<TabView selectedIndex="0" (selectedIndexChange)="onIndexChanged($event)" iosIconRenderingMode="alwaysTemplate" selectedTabTextColor="blue" sdkExampleTitle sdkToggleNavButton>
<TabView iosIconRenderingMode="alwaysOriginal"></TabView>
<StackLayout *tabItem="{title: 'First Tab',iconSource:'res://store'}" >
<first-page></first-page>
</StackLayout>
<StackLayout *tabItem="{title: 'Second Tab',iconSource:'res://myapps'}" >
<second-page></second-page>
</StackLayout>
<StackLayout *tabItem="{title: 'Third Tab',iconSource:'res://home'}" >
<third-page></third-page>
</StackLayout>
</TabView>
main.activity.ts:
public onIndexChanged(args) {
let tabView = <TabView>args.object;
console.log("Selected index changed! New inxed: " + tabView.selectedIndex);
}