Assigning a class to selected users

I have list of allUsers. v-for it’s easy.
Some of them are active users.
I have them in the second list of active Users. how can I achieve that active use assigns another class in the list of all users?

Thx a lot for help.

Do you mean something like this?

<div v-for="user in allUsers" :class="{ active: activeUsers.includes(user) }">
  {{ user }}

This assumes === equality across the two arrays. If that doesn’t apply then you’d need to provide more details.

1 Like