Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

add active class when element exists into an array vuejs

<li v-for="(tag, index) in tags" :key="index" :class="{active: tag.active}">
    <a href="#" @click.prevent="tag.active = !tag.active">{{ tag.name }}</a>
</li>
 
PREVIOUS NEXT
Tagged: #add #active #class #element #exists #array #vuejs
ADD COMMENT
Topic
Name
5+6 =