使用class样式
普通的使用class样式:
<h1 class="red thin">我是h1标签!!!</h1>
- 直接传递一个数组,注意: 这里的 class 需要使用 v-bind 做数据绑定
数组中使用引号代表class样式名,不带引号则为变量名
<h1 :class="['red', 'thin']">我是h1标签!!!</h1>
- 在数组中使用三元表达式
<h1 :class="['red', 'thin', isactive?'active':'']">我是h1标签!!!</h1>