vue的style绑定background-image的方式和其他变量数据的区别详解
时间:2021-02-10 14:52:39|栏目:vue|点击: 次
问题:使用vue加载图片变量,为了图片的自适应,需设置为背景图居中排布
<tr v-for="(item,index) in dataObj">
<td class="video-msg" v-bind:id="item.videoid">
<div class="videoImg fl" v-bind:style="{backgroundImage:'url(' + item.videopic + ')'}">
</div>
</td>
<td v-if="item.videoisdel == 3">审核中</td>
<td>{{item.publishdate}}</td>
<td>sss
<button class="delete" @click='delConfirm(item.videoid)'>删除</button>
</td>
</tr>
行内样式的写法:
v-bind:style="{backgroundImage:'url(' + item.videopic + ')', backgroundRepeat:'no-repeat', backgroundPosition:'center center', backgroundSize: 'contain'}"
上一篇:vue点击当前路由高亮小案例
栏 目:vue
本文标题:vue的style绑定background-image的方式和其他变量数据的区别详解
本文地址:http://www.codeinn.net/misctech/60692.html






