owntone-server/web-src/src/components/NavbarItemLink.vue

35 lines
665 B
Vue
Raw Normal View History

<template>
<a class="navbar-item" :href="href" @click.stop.prevent="open">
<slot />
</a>
</template>
<script>
import * as types from '@/store/mutation_types'
export default {
name: 'NavbarItemLink',
props: {
2024-02-28 13:10:08 +01:00
to: { required: true, type: Object }
},
computed: {
href() {
return this.$router.resolve(this.to).href
}
},
methods: {
open() {
if (this.$store.state.show_burger_menu) {
this.$store.commit(types.SHOW_BURGER_MENU, false)
}
if (this.$store.state.show_player_menu) {
this.$store.commit(types.SHOW_PLAYER_MENU, false)
}
this.$router.push(this.to)
}
}
}
</script>