给图片绑定bindload事件
bindload解释
<image bindload="imageload" wx:else src="{{item.picurl}}" mode="widthFix" />
imageload: function (e) {//获取图的高度
var that = this;
var winwid = wx.getSystemInfoSync().windowWidth;//获取当前屏幕宽度
var imgh = e.detail.height;
var imgw = e.detail.width;
var swiperh = winwid * imgh / imgw + "px";//像素单位可自行修改
console.log(swiperh);
that.setData({
imgh: swiperh,
})
},
这样就获取图片的高度!!