Close burger 'menu' when clicking items in mobile view.

This commit is contained in:
Kailash Nadh 2022-01-05 20:20:55 +05:30
parent b0787f7331
commit 2f56057fc3
2 changed files with 14 additions and 2 deletions

View file

@ -1,7 +1,7 @@
<template>
<div id="app">
<b-navbar :fixed-top="true" v-if="$root.isLoaded">
<template slot="brand">
<template #brand>
<div class="logo">
<router-link :to="{name: 'dashboard'}">
<img class="full" src="@/assets/logo.svg"/>
@ -9,7 +9,7 @@
</router-link>
</div>
</template>
<template slot="end">
<template #end>
<navigation v-if="isMobile" :isMobile="isMobile"
:activeItem="activeItem" :activeGroup="activeGroup" @toggleGroup="toggleGroup"
@doLogout="doLogout" />

View file

@ -100,6 +100,18 @@ export default {
this.$emit('doLogout');
},
},
mounted() {
// A hack to close the open accordion burger menu items on click.
// Buefy does not have a way to do this.
if (this.isMobile) {
document.querySelectorAll('.navbar li a[href]').forEach((e) => {
e.onclick = () => {
document.querySelector('.navbar-burger').click();
};
});
}
},
};
</script>