diff --git a/src/components/app/app.ts b/src/components/app/app.ts index 3daa71d..3c2c458 100644 --- a/src/components/app/app.ts +++ b/src/components/app/app.ts @@ -98,20 +98,6 @@ export default class App extends Vue { // Show splash console.log(Constants.SPLASH); - - // Set history state (TODO: Dynamically detect initial url - window.history.replaceState({lastTab: 'overall'}, '', '/overall'); - - // Create history state listener - window.onpopstate = e => - { - if (e.state) - { - // Restore previous tab - console.log(`onPopState: Current: ${this.selectedTab}, Previous: ${e.state.lastTab}`); - this.selectedTab = e.state.lastTab; - } - }; } /** diff --git a/src/components/navigation/navigation.ts b/src/components/navigation/navigation.ts index 6678b27..95098b2 100644 --- a/src/components/navigation/navigation.ts +++ b/src/components/navigation/navigation.ts @@ -9,10 +9,34 @@ import Constants from '@/constants'; }) export default class Navigation extends Vue { - public activeIndex: string = 'overall'; + // @ts-ignore + @Prop() activeIndex: string; @Prop() courses: any; + /** + * This is called when the instance is created. + */ + public created() + { + // Show splash TODO: Remove + console.log('Created Navigation'); + + // Set history state (TODO: Dynamically detect initial url + window.history.replaceState({lastTab: 'overall'}, '', '/overall'); + + // Create history state listener + window.onpopstate = e => + { + if (e.state) + { + // Restore previous tab + console.log(`onPopState: Current: ${this.activeIndex}, Previous: ${e.state.lastTab}`); + this.activeIndex = e.state.lastTab; + } + }; + } + /** * This function is called when the selection changes. *