class
1.
<div v-bind:class="{ active: isActive }"></div>
2.
<div class="static"
v-bind:class="{ active: isActive, 'text-danger': hasError }">
</div>
3.
<div v-bind:class="classObject"></div>
data: {
classObject: {
active: true,
'text-danger': false
}
}
4.
<div v-bind:class="[activeClass, errorClass]"></div>
data: {
activeClass: 'active',
errorClass: 'text-danger'
}
5.
<div v-bind:class="[isActive ? activeClass : '', errorClass]"></div>
6.
<div v-bind:class="[{ active: isActive }, errorClass]"></div>
style
1.
<div v-bind:style="{ color: activeColor, fontSize: fontSize + 'px' }"></div>
2.
<div v-bind:style="styleObject"></div>
data: {
styleObject: {
color: 'red',
fontSize: '13px'
}
}
3.
<div v-bind:style="[baseStyles, overridingStyles]"></div>
4.
<div :style="{ display: ['-webkit-box', '-ms-flexbox', 'flex'] }"></div>