fix active main routes buttons
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
<nav class="nav-list d-none d-tb-block">
|
||||
<ul>
|
||||
<li v-for="link in mainRoutes" :key="link.to">
|
||||
<b-button :to="{ name: link.to }" :active="$route.name === link.to" :variant="link.variant">
|
||||
<b-button :to="{ name: link.to }" :active="routeIsActive(link.to)" :variant="link.variant">
|
||||
{{ $t('sections.' + link.to) }}
|
||||
</b-button>
|
||||
</li>
|
||||
@@ -87,6 +87,14 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
routeIsActive (to) {
|
||||
return to === 'gallery'
|
||||
? ['gallery', 'gallery-view'].includes(this.$route.name)
|
||||
: this.$route.name === to
|
||||
}
|
||||
},
|
||||
|
||||
created () {
|
||||
this.$store.dispatch('GET_BURGER')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user