使用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>

你可能感兴趣的:(使用computed计算属性进行传参)