img-box.js 818 字节
Component({
    properties: {
        item: { 
            type: Object
        }
    },
    methods: {
        //获取图片真实宽度
        imageLoad: function (e) {
            var img_width = e.detail.width,
                img_height = e.detail.height,
                //宽高比
                ratio = img_width / img_height;
            // console.log('图片组件',e,img_width, img_height);
            //计算的高度值
            var viewHeight = 750 / ratio;
            var img_height = viewHeight;
            var img_heights = this.data.img_heights;
            //把每一张图片的对应的高度记录到数组里
            // img_heights[e.target.dataset.id] = img_height;
            // this.setData({
            //     img_heights: img_heights
            // })
        },
    }
})