ranking.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // compontents/ranking/ranking.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. friendsData: {
  8. type: Array,
  9. value: []
  10. },
  11. friendsThreeData: {
  12. type: Array,
  13. value: []
  14. },
  15. myData: {
  16. type: Object,
  17. value: {}
  18. },
  19. str: {
  20. type: String,
  21. value: ''
  22. },
  23. title: {
  24. type: String,
  25. value: ''
  26. },
  27. height: {
  28. type: String,
  29. value: ''
  30. }
  31. },
  32. /**
  33. * 组件的初始数据
  34. */
  35. data: {
  36. animationData: {},
  37. },
  38. /**
  39. * 组件的方法列表
  40. */
  41. methods: {
  42. more (e) {
  43. let height = this.properties.friendsData.length * 80;
  44. this.util(height+'rpx')
  45. },
  46. /* 创建动画并执行 */
  47. util (height) {
  48. // 创建动画实例
  49. var animation = wx.createAnimation({
  50. duration: 200, //动画时长
  51. timingFunction: "linear", //线性
  52. delay: 0 //0则不延迟
  53. });
  54. this.animation = animation;
  55. animation.height(height).step();
  56. this.setData({
  57. animationData: animation.export()
  58. })
  59. },
  60. }
  61. })