Vue js Add active class to current Navigation Menu

Vue js Add active class to current Navigation Menu

In this Post We Will Explain About is Vue js Add active class to current Navigation Menu With Example and Demo.Welcome on infinityknow.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to add active class onclick Vue js Example

In this post we will show you Best way to implement Vue js add active class to current page, hear for How to Add Active Class to a Navigation Menu Based vuejs with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

READ :  AngularJs Events Directives With Example

Vue js active class on click

In this Example,First of all Add or Inluce External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priorty set.After that Include your relavant CSS Class.

External Libs

<a href="https://unpkg.com/vue/dist/vue.js">https://unpkg.com/vue/dist/vue.js</a>

index.html

<div id="liveApp">
<ul>
  
</ul>
</div>


  <li>
    <h1>{{title}}</h1>
    <p>{{content}}</p>
  </li>

index.js

new Vue({
	el: '#liveApp',
  data: {
  	items: [
    	{title: 'Home', content: 'Content 1'},
      {title: 'About', content: 'Content 2'}
    ],
    activeLiIndex: null
  },
  components: {
  	'live-menu-list': {
    	template: '#live-menu-list',
      props: ['title', 'content', 'active', 'index'],
      methods: {
      	livetoggleClass() {
          this.$emit('newactive', this.index);
        }
      }
    }
  }
});


style.css

.active {
  background-color: blue;
}

You are Most welcome in my youtube Channel Please shubscibe my channel. and give me feedBackMore Details……
Angularjs Example

READ :  Angular 2 Installation CLI setup environment

Example

I hope you have Got What is vue js Change active class when link is selected And how it works.I would Like to have FeaeBack From My Blog(infinityknow.com) readers.Your Valuable FeedBack,Any Question,or any Comments abaout This Article(infinityknow.com) Are Most Always Welcome.

Add a Comment

Your email address will not be published. Required fields are marked *