Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Toggle Sidenav when click on the nav-item

Tenarius free asked 4 years ago


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?


Allabreve free commented 4 years ago

have you thought about using "expandOnHover"?

https://mdbootstrap.com/docs/vue/navigation/sidenav/#docsTabsAPI


Magdalena Dembna staff answered 4 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


Tenarius free commented 4 years ago

This one works for me. Tank you!



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: 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