swiper-nav.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  2. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  3. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  4. else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  5. return c > 3 && r && Object.defineProperty(target, key, r), r;
  6. };
  7. import { SuperComponent, wxComponent } from '../common/src/index';
  8. import config from '../common/config';
  9. const { prefix } = config;
  10. const name = `${prefix}-swiper-nav`;
  11. let SwiperNav = class SwiperNav extends SuperComponent {
  12. constructor() {
  13. super(...arguments);
  14. this.externalClasses = [`${prefix}-class`];
  15. this.properties = {
  16. current: {
  17. type: Number,
  18. value: 0,
  19. },
  20. total: {
  21. type: Number,
  22. value: 0,
  23. },
  24. type: {
  25. type: String,
  26. value: 'dots',
  27. },
  28. minShowNum: {
  29. type: Number,
  30. value: 2,
  31. },
  32. showControls: {
  33. type: Boolean,
  34. value: false,
  35. },
  36. direction: {
  37. type: String,
  38. value: 'horizontal',
  39. },
  40. paginationPosition: {
  41. type: String,
  42. value: 'bottom',
  43. },
  44. };
  45. this.relations = {
  46. '../swiper/swiper': {
  47. type: 'parent',
  48. },
  49. };
  50. this.data = {
  51. prefix,
  52. classPrefix: name,
  53. };
  54. this.methods = {
  55. nav(e) {
  56. var _a;
  57. const { dir } = e.target.dataset;
  58. const source = 'nav';
  59. this.triggerEvent('navBtnChange', { dir, source });
  60. if (this.$parent) {
  61. (_a = this.$parent) === null || _a === void 0 ? void 0 : _a.doNavBtnChange(dir, source);
  62. }
  63. },
  64. };
  65. }
  66. };
  67. SwiperNav = __decorate([
  68. wxComponent()
  69. ], SwiperNav);
  70. export default SwiperNav;