需求,根据传递过来的宽高比,进行宽高的重新计算
computed:{
imgWD(o){
return function(o){
return {
width:'370px',
height:370*(1/o) + 'px'
}
}
}
}
<div :style="imgWD(item.crown)" class="img-detail">
<image resize='stretch' class="itemPhoto" :src="imgUrl + item.photoName"></image>
</div>