vue.js - vue v-for渲染的数据 到CSS 需要怎么弄。
本文介绍了vue.js - vue v-for渲染的数据 到CSS 需要怎么弄。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
下面是css样式
需要把css的背景图片的地址改成。数据给的。 需要怎么操作。。
解决方案
返回来的时'01-1'还是一整个图片链接?我用01-1来举例吧!
你弄成内联样式就可以了!(你图片文件夹的名字,应该是images)
<div class="intermediate_bg_show" v-if="index===listIndex" :style="{'background':'url(./images/'+item.url+'.png) no-repeat top right'}">
</div>
用class方式也可以
<div class="intermediate_bg_show" v-if="index===listIndex" :class="{'intermediate_bg_show'+index}">
</div>
css
.intermediate_bg_show1{
background:url("./images/01-1.png") no-repeat top right'
}
.intermediate_bg_show2{
background:url("./images/01-2.png") no-repeat top right'
}
...
这篇关于vue.js - vue v-for渲染的数据 到CSS 需要怎么弄。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文