index.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. rootPortal: {
  67. type: Boolean,
  68. value: false,
  69. },
  70. },
  71. created: function () {
  72. this.observeClass();
  73. },
  74. methods: {
  75. onClickCloseIcon: function () {
  76. this.$emit('close');
  77. },
  78. onClickOverlay: function () {
  79. this.$emit('click-overlay');
  80. if (this.data.closeOnClickOverlay) {
  81. this.$emit('close');
  82. }
  83. },
  84. observeClass: function () {
  85. var _a = this.data, transition = _a.transition, position = _a.position, duration = _a.duration;
  86. var updateData = {
  87. name: transition || position,
  88. };
  89. if (transition === 'none') {
  90. updateData.duration = 0;
  91. this.originDuration = duration;
  92. }
  93. else if (this.originDuration != null) {
  94. updateData.duration = this.originDuration;
  95. }
  96. this.setData(updateData);
  97. },
  98. },
  99. });