0👍
I fixed this by adding some custom logic to the afterEach
function within the Vue Router.
router.afterEach((to,from) => {
// Clear all buttons
const btns = document.querySelectorAll('.vs-sidebar-item-active');
btns.forEach( el => {
el.classList.remove('vs-sidebar-item-active')
});
// Highlight correct button
var item = document.querySelector("div.page-" + to.name);
if (item) {
item.classList.add('vs-sidebar-item-active');
}
});
You need to add the appropriate class names to the vs-sidebar-item
s. Here I’ve got classes of page-***
to match the name of the route.
- [Vuejs]-Vue draggable does not update text input fields when switched, but does update it in the array
- [Vuejs]-Vue bootstrap image overflow scroll in carousel
Source:stackexchange.com