yaminncco / vue-sidebar-menu

A Vue.js Sidebar Menu Component
MIT License
646 stars 194 forks source link

Add option to pin activeRecordIndex via. cookie or similar #228

Closed GeorgeGardiner closed 9 months ago

GeorgeGardiner commented 2 years ago

It is fairly common in admin panel type applications to use a sidebar menu that links an index of items matching a filter. Clicking an item in the result index will then typically route to an "update / edit" screen.

The current mechanism for determining which menu item is active (based on route) is not a particularly good fit for this use case as clicking through will void the activeRecordIndex and collapse the menu.

Would it be possible for the menu to maintain state via. a cookie or similar? Currently when there is no good match the sidebar menu will just expand the final child which is an odd behaviour in and of itself.

Or bring back alias matching :)

yaminncco commented 2 years ago

Can you give more information about the case? because I'm not sure I understand the issue.

GeorgeGardiner commented 2 years ago

Consider the menu structure:

Basically want the menu to open correctly on both:

/products/live /product/live/123

yaminncco commented 2 years ago

Nested routes should work

const routes = [
  {
    path: '/products',
    component: ...,
    children: [
      { path: 'live' },
      { path: 'live/:id' },
    ]
  }
]