vuejs check class when click code example
Example 1: if cluse in class in vue
<div :class="{'collapse':true , 'show' : key == 0 ? true : false }">
</div>
Example 2: if cluse in class in vue
<template>
<span :class="computedClass">
We've learned so much about conditional class bindings!
</span>
</template>
export default {
computed: {
computedClass() {
let className = 'default';
// More complicated logic to determine what
// class should be applied
return className;
}
}
}