How to add class in v-if Vue.js

    By: Thad Mertz
    3 years ago

    The simplest way is

    :class="(post_id == post.id) ? 'list-item active' : 'list-item'"
    

    so i have a class present there "list-item" and i am adding active class only if condition is true