imageload(e){
var { height, width } = e.detail;
if(height>=width){
if(height/width>2){
this.setData({
imageMode:"aspectFill",
imgHeight : 360,
imgWidth : 180,
})
return
}else if(height/width>1.3){
this.setData({
imageMode:"heightFix",
imgHeight : 350
})
}else{
this.setData({
imageMode:"heightFix",
imgHeight : 320
})
}
}else{
var ratio=width/height
if(ratio>2){
this.setData({
imageMode:"aspectFill",
imgHeight : 250,
imgWidth : 500,
})
}else if(ratio>1.3){
this.setData({
imageMode:"widthFix",
imgWidth : 400
})
}else{
this.setData({
imageMode:"widthFix",
imgWidth : 350
})
}
}
},
很不错啊,加油
一般需求,图片在页面显示尺寸都是固定的
大家有更好的解决方案可以交流一下