So as the title suggest, I am trying to give each menu item a different colour when its active. I have attempted trying to achieve this by following these 2 code examples
1 -> https://codepen.io/Ranushka/pen/KKPBYQv
2 -> https://codepen.io/Ranushka/pen/ZEzjdrO
But I am struggling because in these examples they are working with a for loop. So I have tried adjusting the code but is not working out for me.
You can find my code here -> https://codepen.io/GY22/pen/vYNeOvQ
<nav class="nav bg-darkGrey fixed w-full z-10 top-0 shadow">
<div class="w-full flex-grow lg:flex lg:items-center lg:w-auto lg:block mt-2 lg:mt-0 bg-darkGrey z-20">
<ul class="list-reset lg:flex flex-1 items-center px-4 md:px-0">
<li class="mr-6 my-2 md:my-0">
<router-link :to="/page1" class="block py-1 md:py-3 pl-1 align-middle text-grey-900 no-underline
hover:text-red-800 border-b-4 border-gray-900 hover:border-red-800">
<i class="fas fa-th-large fa-fw mr-3"></i>
<span class="pb-1 md:pb-0 text-sm uppercase">Dashboard</span>
</router-link>
</li>
<li class="mr-6 my-2 md:my-0">
<router-link :to="/page2" class="block py-1 md:py-3 pl-1 align-middle text-grey-900 no-underline
hover:text-blue-400 border-b-4 border-gray-900 hover:border-blue-400">
<i class="fas fa-th-large fa-fw mr-3"></i>
<span class="pb-1 md:pb-0 text-sm uppercase">Users</span>
</router-link>
</li>
<li class="mr-6 my-2 md:my-0">
<router-link :to="/page3" class="block py-1 md:py-3 pl-1 align-middle text-grey-900 no-underline
hover:text-pink-400 border-b-4 border-gray-900 hover:border-pink-400">
<i class="fas fa-th-large fa-fw mr-3"></i>
<span class="pb-1 md:pb-0 text-sm uppercase">Posts</span>
</router-link>
</li>
</ul>
</div>
</nav>
This is what I am trying to achieve
I hope someone can steer me in the right direction. Thanks in advance