Chrome Extension

Add class to an element condition based in Vuejs

    <div v-bind:class="{'show_me': index === 0}">
        Hello World

    export default {
        data: function() {
            return {
                index: 0
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

In Vuejs, if you want to add CSS class to an element, you can use v-bind:class attribute of Vuejs. In the code snippet, we have added class "show_me" based on index value that is defined in data when exporting this Vue component.

Was this helpful?
Join Devsheet Ask a Question