Popover used as navigation submenu doesn't show active style based on current route. Vue3, Inertija.js, TailwindUI #2325
-
I am using Laravel with Inertia.js and Vue v3. I have persistent layout which has navbar with regular links and popover/submenu links.
But when using same approach with Popover and trying to show active state on PopoverButton it doesn't work (until I click again on that same button) so visualy looks terrible and as bug:
If I would use non-persistent layouts it would work since it rerenders whole layout on each route change. But how to make it work with persistent layout? I tried to make computed boolean property settingsNavActive, but prop is not getting updated on route change. Also, I tried to use vue watch on route() and route().current() change, but no luck. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I fixed it using this code:
Also, popover is not auto-closed when using persistent layouts, so there is one more "fix" to close it on route change:
If anyone has different or better solution for this use case other than using Inertia navigate event, I would love to hear about it. |
Beta Was this translation helpful? Give feedback.
I fixed it using this code:
Also, popover is not auto-closed when using persistent layouts, so there is one more "fix" to close it on route change: