vue如何设置动态背景图片
<div class="img" v-for="(cardImgVal, index) in cardImg" :key="index" @click="go(cardImgVal)"> <div class="card" :style="{background: 'url( '+ cardImgVal.imageURL +')'}"></div> </div>
需要绑定 style属性
cardImg 存放数据的数组
cardImgVal 自己起的名字
cardImgVal.imageURL 图片的地址