custom-swiper.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. disableTouch: false,
  15. previousMargin: '0px',
  16. nextMargin: '0px',
  17. },
  18. methods: {
  19. tapHandler(e) {
  20. if (this.props.onTap) {
  21. const tapEvent = processDataSet(e, this.props)
  22. this.props.onTap(tapEvent)
  23. }
  24. },
  25. catchTapHandler(e) {
  26. if (this.props.catchTap) {
  27. const tapEvent = processDataSet(e, this.props)
  28. this.props.catchTap(tapEvent)
  29. }
  30. },
  31. changeHandler(e) {
  32. if (this.props.onChange) {
  33. const tapEvent = processDataSet(e, this.props)
  34. this.props.onChange(tapEvent)
  35. }
  36. },
  37. transitionHandler(e) {
  38. if (this.props.onTransition) {
  39. const tapEvent = processDataSet(e, this.props)
  40. this.props.onTransition(tapEvent)
  41. }
  42. },
  43. animationEndHandler(e) {
  44. if (this.props.onAnimationEnd) {
  45. const tapEvent = processDataSet(e, this.props)
  46. this.props.onAnimationEnd(tapEvent)
  47. }
  48. },
  49. },
  50. })