问题:使用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'}"
原文地址:https://blog.csdn.net/qq_34664239/article/details/79106570
Logo

前往低代码交流专区

更多推荐