index.js 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var component_1 = require("../common/component");
  4. var transition_1 = require("../mixins/transition");
  5. (0, component_1.VantComponent)({
  6. classes: [
  7. 'enter-class',
  8. 'enter-active-class',
  9. 'enter-to-class',
  10. 'leave-class',
  11. 'leave-active-class',
  12. 'leave-to-class',
  13. 'close-icon-class',
  14. ],
  15. mixins: [(0, transition_1.transition)(false)],
  16. props: {
  17. round: Boolean,
  18. closeable: Boolean,
  19. customStyle: String,
  20. overlayStyle: String,
  21. transition: {
  22. type: String,
  23. observer: 'observeClass',
  24. },
  25. zIndex: {
  26. type: Number,
  27. value: 100,
  28. },
  29. overlay: {
  30. type: Boolean,
  31. value: true,
  32. },
  33. closeIcon: {
  34. type: String,
  35. value: 'cross',
  36. },
  37. closeIconPosition: {
  38. type: String,
  39. value: 'top-right',
  40. },
  41. closeOnClickOverlay: {
  42. type: Boolean,
  43. value: true,
  44. },
  45. position: {
  46. type: String,
  47. value: 'center',
  48. observer: 'observeClass',
  49. },
  50. safeAreaInsetBottom: {
  51. type: Boolean,
  52. value: true,
  53. },
  54. safeAreaInsetTop: {
  55. type: Boolean,
  56. value: false,
  57. },
  58. safeAreaTabBar: {
  59. type: Boolean,
  60. value: false,
  61. },
  62. lockScroll: {
  63. type: Boolean,
  64. value: true,
  65. },
  66. },
  67. created: function () {
  68. this.observeClass();
  69. },
  70. methods: {
  71. onClickCloseIcon: function () {
  72. this.$emit('close');
  73. },
  74. onClickOverlay: function () {
  75. this.$emit('click-overlay');
  76. if (this.data.closeOnClickOverlay) {
  77. this.$emit('close');
  78. }
  79. },
  80. observeClass: function () {
  81. var _a = this.data, transition = _a.transition, position = _a.position, duration = _a.duration;
  82. var updateData = {
  83. name: transition || position,
  84. };
  85. if (transition === 'none') {
  86. updateData.duration = 0;
  87. this.originDuration = duration;
  88. }
  89. else if (this.originDuration != null) {
  90. updateData.duration = this.originDuration;
  91. }
  92. this.setData(updateData);
  93. },
  94. },
  95. });