Skip to content

Commit

Permalink
Allow the nav bar to persist the selected item style. (#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
jetfuel committed Feb 22, 2018
1 parent 7ecb82c commit b6b606d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
19 changes: 16 additions & 3 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div id="app">
<v-app>
<AppMenu>
<AppMenu :initialRoute="initialRoute">
</AppMenu>
<router-view></router-view>
</v-app>
Expand All @@ -12,9 +12,22 @@
import AppMenu from './common/component/AppMenu'
export default {
name: 'App',
components: {
name: 'App',
components: {
AppMenu
},
data() {
return {
initialRoute: "scalars"
}
},
created() {
if (location.hash && location.hash != '#/') {
this.initialRoute = /(\#\/)(\w*)([?|&]{0,1})/.exec(location.hash)[2];
}
else {
location.hash = '#/scalars';
}
}
}
</script>
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/common/component/AppMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@

<script>
export default {
props: ['initialRoute'],
name: 'AppMenu',
data () {
return {
selected: 'scalars',
selected: this.initialRoute,
items: [
{
url: '/scalars',
Expand Down

0 comments on commit b6b606d

Please sign in to comment.