1、对象语法
<div class="static"
v-bind:class="{ active: isActive, 'text-danger': hasError }">
</div>
data: {
isActive: true,
hasError: false
}
2、数组语法
<div v-bind:class="[isActive ? activeClass : '', errorClass]"></div>
1、对象语法
<div class="static"
v-bind:class="{ active: isActive, 'text-danger': hasError }">
</div>
data: {
isActive: true,
hasError: false
}
2、数组语法
<div v-bind:class="[isActive ? activeClass : '', errorClass]"></div>