index.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. lockScroll: {
  59. type: Boolean,
  60. value: true,
  61. },
  62. },
  63. created: function () {
  64. this.observeClass();
  65. },
  66. methods: {
  67. onClickCloseIcon: function () {
  68. this.$emit('close');
  69. },
  70. onClickOverlay: function () {
  71. this.$emit('click-overlay');
  72. if (this.data.closeOnClickOverlay) {
  73. this.$emit('close');
  74. }
  75. },
  76. observeClass: function () {
  77. var _a = this.data, transition = _a.transition, position = _a.position, duration = _a.duration;
  78. var updateData = {
  79. name: transition || position,
  80. };
  81. if (transition === 'none') {
  82. updateData.duration = 0;
  83. this.originDuration = duration;
  84. }
  85. else if (this.originDuration != null) {
  86. updateData.duration = this.originDuration;
  87. }
  88. this.setData(updateData);
  89. },
  90. },
  91. });