index.js 849 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import {
  2. getBannerList
  3. } from '~/api/global'
  4. Component({
  5. properties: {
  6. classify: {
  7. type: Number,
  8. value: 1
  9. }
  10. },
  11. data: {
  12. bannerList: []
  13. },
  14. lifetimes: {
  15. attached() {
  16. this.getBannerList()
  17. },
  18. },
  19. /**
  20. * 组件的方法列表
  21. */
  22. methods: {
  23. async getBannerList() {
  24. let bannerList = await getBannerList(this.properties.classify)
  25. this.setData({
  26. bannerList
  27. })
  28. },
  29. bannelEvent({
  30. currentTarget
  31. }) {
  32. //1:图片,2:邀新榜,3:热播榜,4:挑战pk榜,5,朗读赛,6,领取勋章
  33. switch (currentTarget.dataset.type) {
  34. case 1:
  35. break;
  36. case 2:
  37. wx.navigateTo({
  38. url: '/pages/ranking/index?type=2&title=邀新榜',
  39. })
  40. break;
  41. default:
  42. }
  43. },
  44. }
  45. })