Topic: Toggle Sidenav when click on the nav-item
I want the Sidenav 2 to be toggled/closed when I click on an nav-item.
Is there a simple possibility/api to do that?
Magdalena Dembna staff premium answered 5 years ago
We are currently working on improving @itemClick
events - so in the future, they could be used for those purposes. Unfortunately, right now I cannot give the specific date then this update will be out.
Although, if you're using router-links, there is a very simple solution you can use:
watch: {
$route() {
this.show = false;
}
By adding this watcher, you hide the side nav every time the route changes.
If you don't want to toggle side nav on every item click and just add a toggler within, you can try using a content
(below items) or content-header
(above) slot and create your toggler there. Let me know if any of those solutions were useful. Best regards,
Magdalena
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- User: Free
- Premium support: No
- Technology: MDB Vue
- MDB Version: 6.7.1
- Device: PC
- Browser: Firefox
- OS: Windows 10
- Provided sample code: No
- Provided link: No
Allabreve commented 5 years ago
have you thought about using "expandOnHover"?
https://mdbootstrap.com/docs/vue/navigation/sidenav/#docsTabsAPI