Today, We want to share with you VueJS Add active class li onClick navigation menu item.In this post we will show you add/remove active class for ul list with vue js, hear for Add Active Navigation Class Based on URL using VueJS we will give you demo and example for implement.In this post, we will learn about Add active class to navigation menu item based on URL using VueJS with an example.
VueJS Add active class li onClick navigation menu item
There are the Following The simple About VueJS Add active class li onClick navigation menu item Full Information With Example and source code.
As I will cover this Post with live Working example to develop VueJS Add active class to main menu, so the some major files and Directory structures for this example is following below.
- index.html
- main.js
- style.css
HTML Interface
index.html
This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.html.
VueJS Add active class to main menu
{{activeId}}
Vuejs Files
vuejs main logic script
new Vue({ el: '#myApp', data: { activeId : 0, members: [ { id :1, status: 'Jaydeep 1' }, { id :2, status: 'Rakesh 2' }, { id :3, status: 'Krunal 3' }, ] }, methods: { selectMember: function (id) { this.activeId = id; } } })
style.css
Custom css style
.active { color : green; }
VueJS Active Item
Angular 6 CRUD Operations Application Tutorials
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about VueJS Add active class li onClick navigation menu item.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.