custom-swiper.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const processDataSet = require('../utils/processDataSet')
  2. Component({
  3. data: {},
  4. props: {
  5. duration: 500,
  6. indicatorDots: false,
  7. indicatorColor: 'rgba(0, 0, 0, .3)',
  8. indicatorActiveColor: '#000',
  9. autoplay: false,
  10. current: 0,
  11. interval: 5000,
  12. circular: false,
  13. vertical: false,
  14. previousMargin: '0px',
  15. nextMargin: '0px',
  16. },
  17. methods: {
  18. tapHandler(e) {
  19. if (this.props.onTap) {
  20. const tapEvent = processDataSet(e, this.props)
  21. this.props.onTap(tapEvent)
  22. }
  23. },
  24. catchTapHandler(e) {
  25. if (this.props.catchTap) {
  26. const tapEvent = processDataSet(e, this.props)
  27. this.props.catchTap(tapEvent)
  28. }
  29. },
  30. changeHandler(e) {
  31. if (this.props.onChange) {
  32. const tapEvent = processDataSet(e, this.props)
  33. this.props.onChange(tapEvent)
  34. }
  35. },
  36. transitionHandler(e) {
  37. if (this.props.onTransition) {
  38. const tapEvent = processDataSet(e, this.props)
  39. this.props.onTransition(tapEvent)
  40. }
  41. },
  42. animationEndHandler(e) {
  43. if (this.props.onAnimationEnd) {
  44. const tapEvent = processDataSet(e, this.props)
  45. this.props.onAnimationEnd(tapEvent)
  46. }
  47. },
  48. },
  49. })