数组语法

    1. <div v-bind:class="[activeClass, errorClass]"></div>
    1. data: {
    2. activeClass: 'active',
    3. errorClass: 'text-danger'
    4. }

    对象语法

    1. <div
    2. class="static"
    3. v-bind:class="{ active: isActive, 'text-danger': hasError }"
    4. ></div>
    1. data: {
    2. isActive: true,
    3. hasError: false
    4. }

    对象与数组混用

    1. <div v-bind:class="[activeClass, {active: isActive}]></div>
    1. data: {
    2. activeClass: 'active',
    3. isActive: true
    4. }