Rumah > Soal Jawab > teks badan
<li v-for="item in items" class="pull-left">
<button type="button" class="btn btn-success"><i class="{{item.icon}}"></i>{{item.name}}</button>
</li>
报错如下
vue.js:2643 [Vue warn]: class="{{item.icon}}": Interpolation inside attributes has been removed. Use v-bind or the colon shorthand instead. For example, instead of <p class="{{ val }}">, use <p :class="val">.
PHP中文网2017-04-10 17:54:19
参考文档 class绑定
我们可以传给 v-bind:class 一个对象,以动态地切换 class 。
<p v-bind:class="{ active: isActive }"></p>