First modify your router-link like this (notice the @click.native
part and using router-link as a
tag)
to="/syllabus 1" @click.native="closeMenu($event)">
Then in your main app, create a function called collapse
with the following code
let app = new Vue({
methods: {
closeMenu($event) {
$($event.currentTarget).closest('.navbar-collapse').collapse('hide');
}
}
});
This should do the trick!
manpreet
Best Answer
2 years ago
i am implementing vue js in bootstrap html template... problem i am facing is in navbar..
my code is
i have also tried using
but the problem is when i am reloading the page the menu collapse and expands normally as it should work but when i am clicking on a a sub menu for instance "syllabus1" the page redirects to syllabus but the menu freezes and does not any longer collapse or expands...then again on reloading the menu starts working fine
please help me with this... thanks in advance... please provide an example in jsfiddle if possible... thankx..