小程序 点击按钮 慢慢淡出隐藏不占位

工作日志  随手笔记 仅供参考

点击关注 关注按钮慢慢淡出隐藏 不占位

<view class='follow' bindtap='bindfollow' animation="{{animationData}}" hidden='{{hidden}}'>
       <image mode='widthFix' src='../imges/follow.png'></image>
</view>
data:{
    animationData:{},
    hidden:false,//关注默认显示
},


// 点击关注隐藏按钮
  bindfollow:function(e){
    var animation = wx.createAnimation({
      duration: 1000,
      timingFunction: 'linear',
    })

    this.animation = animation

    animation.opacity(0).step()

    this.setData({
      animationData: animation.export()
    })

    setTimeout(function () {
      this.setData({
        hidden: true
      })
    }.bind(this), 1000)
    
  },

猜你喜欢

转载自blog.csdn.net/Acitylion/article/details/81112863