mercredi 6 juin 2018

How to control the style of a parent element with CSS and VueJS?

I loop through a set of users to build a table using VueJS 'for' statement.

There's a column called "approved". If it's true then I want the entire table row to be green. How to achieve that?

                <tbody>
                  <tr v-for="user in users" >
                    <td v-for="key in columns">
                        <!-- At This point I can tell if the user is approved but how to change the style of the parent tr element?? -->
                        <span v-if='key == "approved" && user[key] == 0'>
                            Not Approved
                        </span>

                        <span v-else-if='key == "approved" && user[key] == 1'>
                            Approved!
                        </span>

                        <span v-else>
                            
                        </span>
                    </td>
                  </tr>
                </tbody>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire