[Vuejs]-How to add the 'exact' prop in a v-for loop

0👍

Conditionally bind the exact prop like this.

<router-link tag="li" class="link" v-for="item in menu" :key="item.id" :to="item.slug" :exact="item.slug === '/' ? true : false">
   {{ item.content }}
</router-link>

0👍

Have you ever try

<router-link tag="li" class="link" v-for="item in menu" v-bind:key="item.id" :to="item.slug" v-bind={ "exact": item.slug === "/" ? true : false }>{{ item.content }}</router-link>

Leave a comment