2019-07-06 09:21:29 -04:00
|
|
|
<template>
|
2022-02-19 00:39:14 -05:00
|
|
|
<a
|
|
|
|
class="navbar-item"
|
|
|
|
:class="{ 'is-active': is_active }"
|
|
|
|
:href="full_path()"
|
|
|
|
@click.stop.prevent="open_link()"
|
|
|
|
>
|
|
|
|
<slot />
|
2019-07-06 09:21:29 -04:00
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import * as types from '@/store/mutation_types'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'NavbarItemLink',
|
2020-04-18 00:57:55 -04:00
|
|
|
props: {
|
|
|
|
to: String,
|
|
|
|
exact: Boolean
|
|
|
|
},
|
2019-07-06 09:21:29 -04:00
|
|
|
|
|
|
|
computed: {
|
2022-02-19 00:39:14 -05:00
|
|
|
is_active() {
|
2020-04-18 00:57:55 -04:00
|
|
|
if (this.exact) {
|
|
|
|
return this.$route.path === this.to
|
|
|
|
}
|
2019-07-06 09:21:29 -04:00
|
|
|
return this.$route.path.startsWith(this.to)
|
2020-04-18 00:57:55 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
show_player_menu: {
|
2022-02-19 00:39:14 -05:00
|
|
|
get() {
|
2020-04-18 00:57:55 -04:00
|
|
|
return this.$store.state.show_player_menu
|
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
set(value) {
|
2020-04-18 00:57:55 -04:00
|
|
|
this.$store.commit(types.SHOW_PLAYER_MENU, value)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
show_burger_menu: {
|
2022-02-19 00:39:14 -05:00
|
|
|
get() {
|
2020-04-18 00:57:55 -04:00
|
|
|
return this.$store.state.show_burger_menu
|
|
|
|
},
|
2022-02-19 00:39:14 -05:00
|
|
|
set(value) {
|
2020-04-18 00:57:55 -04:00
|
|
|
this.$store.commit(types.SHOW_BURGER_MENU, value)
|
|
|
|
}
|
2019-07-06 09:21:29 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2023-06-07 15:25:54 -04:00
|
|
|
open_link() {
|
2020-04-18 00:57:55 -04:00
|
|
|
if (this.show_burger_menu) {
|
|
|
|
this.$store.commit(types.SHOW_BURGER_MENU, false)
|
|
|
|
}
|
|
|
|
if (this.show_player_menu) {
|
|
|
|
this.$store.commit(types.SHOW_PLAYER_MENU, false)
|
|
|
|
}
|
2019-07-06 09:21:29 -04:00
|
|
|
this.$router.push({ path: this.to })
|
|
|
|
},
|
|
|
|
|
2023-06-07 15:25:54 -04:00
|
|
|
full_path() {
|
2019-07-06 09:21:29 -04:00
|
|
|
const resolved = this.$router.resolve(this.to)
|
|
|
|
return resolved.href
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|