index.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. var safe_area_1 = require("../mixins/safe-area");
  6. component_1.VantComponent({
  7. classes: [
  8. 'enter-class',
  9. 'enter-active-class',
  10. 'enter-to-class',
  11. 'leave-class',
  12. 'leave-active-class',
  13. 'leave-to-class'
  14. ],
  15. mixins: [transition_1.transition(false), safe_area_1.safeArea()],
  16. props: {
  17. transition: {
  18. type: String,
  19. observer: 'observeClass'
  20. },
  21. customStyle: String,
  22. overlayStyle: String,
  23. zIndex: {
  24. type: Number,
  25. value: 100
  26. },
  27. overlay: {
  28. type: Boolean,
  29. value: true
  30. },
  31. closeOnClickOverlay: {
  32. type: Boolean,
  33. value: true
  34. },
  35. position: {
  36. type: String,
  37. value: 'center',
  38. observer: 'observeClass'
  39. }
  40. },
  41. created: function () {
  42. this.observeClass();
  43. },
  44. methods: {
  45. onClickOverlay: function () {
  46. this.$emit('click-overlay');
  47. if (this.data.closeOnClickOverlay) {
  48. this.$emit('close');
  49. }
  50. },
  51. observeClass: function () {
  52. var _a = this.data, transition = _a.transition, position = _a.position;
  53. var updateData = {
  54. name: transition || position
  55. };
  56. if (transition === 'none') {
  57. updateData.duration = 0;
  58. }
  59. this.set(updateData);
  60. }
  61. }
  62. });