jeudi 2 mars 2017

Toggle 2 classes on each element of v-for based on conditions

I'm trying to list a list of chats between 2 users with vue 2. in my style, i have 2 classes 'left' and 'right' helping to display if the chat belongs to the first or the last user.

here is my loop

 <div class="row chats-container">
    <div class="row chat-message clearfix" 
        v-for="chat in chats">
        <img src="./../../assets/userDefault.png" alt="">
        <span></span>
    </div>
 </div>

Here is the condition i want to use : 'v-if="auth.id === chat.sender.id"'

I would like to toggle between two classes : left and right

Need some helps...



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire