重构稿如下:
<div id="show-img" class="showUploadImg">
<li class="" style="background:url(xxx) no-repeat center center;background-size:contain;z-index:10"></li>
<i class="weui-icon-cancel" id="delImg-icon"></i>
</div>
先这样:
<li class="" :style="{background:'url(xxx) no-repeat center center'}" style="background-size:contain;z-index:10"></li>
这种不行。
必须把background要分离开写,如下:
computed: {
specialstyle(){ //样式问题
return {
'background-image' : 'url('+this.apply_info.main_pic+')',
'background-repeat': 'no-repeat',
'background-size' : 'contain',
'background-position':'center',
'z-index': 10,
//'background': 'url('+this.apply_info.main_pic+') no-repeat center center', //这两种方式不行
//'background-size': 'contain',
}
},
}
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。