微信小程序--动画animation

时间:2023-09-04 08:46:20
js:
list:[],
contentflag:false
this.animation = wx.createAnimation({
duration: 500,
timingFunction: 'linear',
})
//
var systemInfo = wx.getSystemInfoSync();
var px = systemInfo.windowWidth;
this.animation.translateX(-px).step()
this.setData({
  animation: this.animation.export()
});
//下拉刷新
bottomhd() {
  var _this = this;
  //调接口
},
//获取失败
err() {
  var _this = this;
  var systemInfo = wx.getSystemInfoSync();
  var px = systemInfo.windowWidth;
  this.animation.translateX(px).step();
  _this.setData({
    animation: this.animation.export(),
  })
},
if (res.data.data.list.length < 10) {
  _this.setData({
    contentflag: true
  });
}
var id = e.currentTarget.dataset.id;
wxml:
<view  animation="{{animation}}">
  <scroll-view scroll-y class='brandcontent' bindscrolltolower="bottomhd">
    <view wx:for="{{list}}" wx:for-index="index" wx:for-item="item" data-id="{{item.code}}" data-name="{{item.name}}" bindtap='getid'>{{item.name}}</view>
    <view wx:if="{{contentflag}}">已经到底了</view>
  </scroll-view>
</view>