第一阶段 第三次作业
固定宽度,利用image的自带bindload的属性,动态计算该图片的高度。将计算出来的高度数据绑定到style的height中
1 | < image class = "top-theme" src = "{{themeA.entrance_img}}" bindload = "autoHeight" style = "height:{{imgHeight}}rpx" ></ image > |
1 2 3 4 5 6 | autoHeight(event) { let imgHeight = event.detail.heigth; this .setData({ imgHeight }) }, |
5
收起
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧