index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // components/My_BannerSwiper/index.js
  2. Component({
  3. /**
  4. * 组件的属性列表
  5. */
  6. properties: {
  7. swiperBannerList: {
  8. type: Array
  9. },
  10. type: {
  11. type: String,
  12. value: "banner" //advertising
  13. },
  14. marTop: {
  15. type: Number,
  16. value: 0
  17. },
  18. marBot: {
  19. type: Number,
  20. value: 0
  21. },
  22. },
  23. /**
  24. * 组件的初始数据
  25. */
  26. data: {
  27. },
  28. /**
  29. * 组件的方法列表
  30. */
  31. methods: {
  32. /* 轮播跳转 */
  33. clickToPage(e) {
  34. const {
  35. index
  36. } = e.target.dataset;
  37. const bannerData = this.data.swiperBannerList[index];
  38. if (bannerData.flinktype == 'URL') {
  39. //url类型内部跳转
  40. wx.navigateTo({
  41. url: bannerData.fhyperlink,
  42. })
  43. } else if (bannerData.flinktype == 'DATA' && bannerData.fdatatable == "tactivity") {
  44. //活动类型跳转展会
  45. wx.navigateTo({
  46. url: '/pages/tradeShow/index?id=' + bannerData.fdataid,
  47. })
  48. }
  49. }
  50. }
  51. })