I am using this code :
<router-link
v-for="item in navigation"
:key="item.name"
:to="item.to"
@click="(item.current = true) "
:class="[
item.current
? 'bg-gray-900 text-white'
: 'text-gray-300 hover:bg-gray-700 hover:text-white',
'group flex items-center px-2 py-2 text-base font-medium rounded-md',
]"
>
const navigation = [
{ name: "Dashboard", to: "/", icon: HomeIcon, current: false },
{ name: "About", to: "/about", icon: UsersIcon, current: false },
{ name: "Projects", to: "about", icon: FolderIcon, current: false },
];`
My question is how can i make this work with routerlink? I want to have the current item change to true when you select it. SO that the tailwind class changes. I tried (item.current = true) but this changes all the current objects to true. The code you see is from tailwind components sidebar example. https://tailwindui.com/components/application-ui/application-shells/sidebar
I now use active-class and that works somehow. But still want to know how to do it probably.