Add dynamic classes with static classes vuejs laravel

    By: Thad Mertz
    2 years ago

    Ok Try this

    v-bind:class="['static classes here', { 'addThisClass' : ifThisReturnsTrue }]"
    

    Replace "addThisClass" with class you want to add dynamically, Condition goes in place of "ifThisReturnsTrue".

    And static class where "static classes here" given.

    if you want to add multiple dynamic classes based on multiple conditions then do this way

    v-bind:class="{ 'addThisClass': ifThisTrue && ifThisTrue,
     'addThisClass': ifThisTrue,
      'addThisClass': ifThisTrue }"
    


    Hope helps.