product-item-status.js 858 Bytes
import router from '../router/router';

Component({
  properties: {
    product: {
      type: Object
    },
    tabIdx: String
  },
  data: {
    animation: null,
  },
  ready: function() {
    let animation = wx.createAnimation({
      duration: 400,
      timingFunction: 'linear',
    });
    //放大缩小循环动画
    var next = true;
    setInterval(function () {
      if (next) {
        animation.scale(1.05).step()   
        next = !next;
      } else {
        animation.scale(1).step({duration:250})
        next = !next;
      }
      this.setData({
        animation: animation.export()
      })
    }.bind(this), 400)
  },
  methods: {
    onClick() {
      router.go('detail', {
        tabIdx: +this.data.tabIdx + 1,
        fromPageParam: +this.data.tabIdx + 1,  
        actPrizeId: this.properties.product.id
      });
    }
  }
});