Skip to content

Commit e64c0a0

Browse files
authored
Mobile sidebar link click should close the sidebar
When a mobile user clicks a link in the sidebar, it should close that sidebar for mobile users. The reason is that the "default" mobile experience ought to be menu-less or content will flow off the screen.
1 parent 0a00ed0 commit e64c0a0

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Vue_Full_Project/src/components/SidebarNavLink.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
</div>
88
<div v-else>
99
<router-link :to="url" :class="classList">
10-
<i :class="icon"></i> {{name}}
11-
<b-badge v-if="badge && badge.text" :variant="badge.variant">{{badge.text}}</b-badge>
10+
<span @click="hideMobile">
11+
<i :class="icon"></i> {{name}}
12+
<b-badge v-if="badge && badge.text" :variant="badge.variant">{{badge.text}}</b-badge>
13+
</span>
1214
</router-link>
1315
</div>
1416
</template>
@@ -53,6 +55,13 @@
5355
linkExternal () {
5456
return isExternal(this.url)
5557
}
58+
},
59+
methods: {
60+
hideMobile () {
61+
if (document.body.classList.contains('sidebar-mobile-show')) {
62+
document.body.classList.toggle('sidebar-mobile-show')
63+
}
64+
}
5665
}
5766
}
5867
</script>

0 commit comments

Comments
 (0)