<span v-for="item in data2Source">
<div class="col-md-3 col-sm-3 col-xs-3">
<span class="iconSize" v-if="item.icon === ''">
<i class="el-icon-news" v-if="item.iconColor === ''" style="background-color: #3EBAEC;"></i>
<i class="el-icon-news" v-else v-bind:style="{'background-color': item.iconColor}"></i>
<font>{{item.name}}</font>
</span>
<span class="iconSize" v-else>
<i :class="item.icon" v-if="item.iconColor === ''" style="background-color: #3EBAEC;"></i>
<i :class="item.icon" v-else v-bind:style="{'background-color': item.iconColor}"></i>
<font>{{item.name}}</font>
</span>
</div>

</span>


直接上代码吧! v-bind:style="{'background-color': item.iconColor}" 为样式赋值,将获取的json 样式赋值给style

Logo

前往低代码交流专区

更多推荐