Answer the question
In order to leave comments, you need to log in
How to give the exact(vue-router library) attribute to the first element of a Vue array?
Hello, I want to display the navigation in the header by iterating through the array using v-for, but I ran into a problem that I need to give the exact attribute (which is responsible for the so-called "home page") to the first element of this list, I
tried using :exact="{'' : index === 0}" - WORKS, but the error in the console is "[Vue warn]: Invalid prop: type check failed for prop "exact. Expected Boolean, got Object"
<li v-for="(item, index) in navItems" :key="index" @click="burgerMenu"><router-link :to="item.to" :exact="{'' : index === 0}">{{item.name}}</router-link></li>
navItems: [
{name: 'Home', to: {name: 'home',}},
{name: 'About', to: {name: 'about'}},
{name: 'Portfolio', to: {name: 'portfolio'}},
{name: 'Contacts', to: {name: 'contacts'}},
]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question