vue绑定列表里面的class

vue绑定列表里面的class

1.html

<ul>
    <li v-bind:class="[itemHot.style]" v-for="itemHot in HotLists">{{itemHot.DataKey}}</li>
</ul>

2.js

HotLists :[{
    DataKey: "123",
    style:"style1"
},{
    DataKey: "456",
    style:"style2"
},{
    DataKey: "789",
    style:"style3"
},]

效果:

猜你喜欢

转载自blog.csdn.net/weixin_40687883/article/details/82221970