vue js in bootstrap navbar

Course Queries Syllabus Queries 2 years ago

0 2 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (2)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

i am implementing vue js in bootstrap html template... problem i am facing is in navbar..

my code is

 tag="li" to="#">
      class="fa fa-book" aria-hidden="true">  class="nav-label">Syllabus class="fa arrow">
      class="nav nav-second-level collapse">
          tag="li" to="/syllabus 1">
                 Syllabus
         
          tag="li" to="/syllabus/topic">
                Syllabus Topic
         
      
 

i have also tried using

  • class="fa fa-book" aria-hidden="true"> class="nav-label">Syllabus class="fa arrow"> class="nav nav-second-level collapse"> tag="li" to="/syllabus"> Syllabus 1 tag="li" to="/syllabus/topic"> Syllabus Topic
  • 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..

    profilepic.png
    manpreet 2 years ago

    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({
       tag/methods">methods: {
          closeMenu($event) {
              $($event.currentTarget).closest('.navbar-collapse').collapse('hide');
          }    
       }
    });

    This should do the trick!


    0 views   0 shares

    No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.