0👍
Using string interpolation;
<div :class="`${isActive ? activeClass : 'red'}`">
Phone OTP
</div>
This allows you to add non-dynamic classes in the future
0👍
There are multiple workarounds to achieve this as per the documentation
, One of them is binding to an object.
<div :class="classObject"></div>
And as per the logic, You can dynamically update it with the help of computed property.
data() {
return {
isActive: true
}
},
computed: {
classObject() {
return {
'activeClass': this.isActive,
'red': !this.isActive
}
}
}
- [Vuejs]-Select row in q-table with button using Vue.js
- [Vuejs]-Vueuse useDark function blocking the ability to transition an element
Source:stackexchange.com