网上找的方法试了一下,还不错效果:
先将图片隐藏hidden,然后当图片加载完成bindload后再将图片渐渐显示出来,高度设为auto,这样效果还不错
1.wxml
<image hidden="{{!showPic}}" animation="{{animationData}}" style="opacity:0;height:auto" bindload="showPicture" src='{{info.img}}' mode="widthFix"></image>
2.js
showPicture: function (){
let that = this
let show = that.data.showPic
let animation = wx.createAnimation({
duration: 500,
timingFunction: 'ease-in',
delay: 0
})
show = true
animation.opacity(1).step()
that.setData({
showPic: show,
animationData: animation.export()
})
},