2019-07-06 09:21:29 -04:00
|
|
|
<template>
|
2019-10-27 02:39:29 -04:00
|
|
|
<a class="navbar-item" :class="{ 'is-active': is_active }" @click.prevent="open_link()" :href="full_path()">
|
2019-07-06 09:21:29 -04:00
|
|
|
<slot></slot>
|
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import * as types from '@/store/mutation_types'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'NavbarItemLink',
|
2020-04-11 13:43:53 -04:00
|
|
|
props: ['to'],
|
2019-07-06 09:21:29 -04:00
|
|
|
|
|
|
|
computed: {
|
|
|
|
is_active () {
|
|
|
|
return this.$route.path.startsWith(this.to)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
open_link: function () {
|
|
|
|
this.$store.commit(types.SHOW_BURGER_MENU, false)
|
|
|
|
this.$router.push({ path: this.to })
|
|
|
|
},
|
|
|
|
|
|
|
|
full_path: function () {
|
|
|
|
const resolved = this.$router.resolve(this.to)
|
|
|
|
return resolved.href
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|