customBannerSwiper.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. Component({
  2. options: {
  3. multipleSlots: true // 在组件定义时的选项中启用多 slot 支持
  4. },
  5. /**
  6. * 组件的属性列表
  7. */
  8. properties: {
  9. myData: Array,
  10. autoplay: {
  11. type: Boolean,
  12. value: true
  13. },
  14. interval: {
  15. type: Number,
  16. value: 4000
  17. },
  18. // 显示指示点
  19. indicatorDots: {
  20. type: Boolean,
  21. value: true
  22. },
  23. indicatorColor: {
  24. type: String,
  25. value: '#00000055'
  26. },
  27. indicatorActiveColor: {
  28. type: String,
  29. value: '#000000'
  30. },
  31. //衔接滑动
  32. circular: {
  33. type: Boolean,
  34. value: true
  35. },
  36. previousMargin: {
  37. type: String,
  38. value: '100rpx'
  39. },
  40. nextMargin: {
  41. type: String,
  42. value: '100rpx'
  43. },
  44. // 两侧图片缩放比例
  45. scale: {
  46. type: Number,
  47. value: 0.8
  48. },
  49. radius: {
  50. type: String,
  51. value: '10rpx'
  52. },
  53. // 两侧图片高度
  54. heightCommon: {
  55. type: String,
  56. value: '100%'
  57. },
  58. heightActive: {
  59. type: String,
  60. value: '100%'
  61. },
  62. // 图片间隔,默认用scale缩放,间隔为0
  63. padding: {
  64. type: String,
  65. value: '0rpx'
  66. },
  67. shadow: {
  68. type: Boolean,
  69. value: false
  70. },
  71. showTitle: {
  72. type: Boolean,
  73. value: false
  74. },
  75. titleStyle: {
  76. type: String,
  77. value: ''
  78. }
  79. },
  80. /**
  81. * 组件的初始数据
  82. */
  83. data: {
  84. currentIndex: 0
  85. },
  86. /**
  87. * 组件的方法列表
  88. */
  89. methods: {
  90. swiperChange(e) {
  91. this.setData({
  92. currentIndex: e.detail.current
  93. });
  94. },
  95. gotoPic(e){
  96. console.log(e.currentTarget.dataset.url);
  97. wx.navigateTo({
  98. url:'/pages/web/web?url='+e.currentTarget.dataset.url
  99. })
  100. }
  101. }
  102. })