使用computed计算属性进行传参

需求,根据传递过来的宽高比,进行宽高的重新计算

 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>

猜你喜欢

转载自blog.csdn.net/xlelou/article/details/81477391
今日推荐