index.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. 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. ],
  14. mixins: [transition_1.transition(false)],
  15. props: {
  16. round: Boolean,
  17. closeable: Boolean,
  18. customStyle: String,
  19. overlayStyle: String,
  20. transition: {
  21. type: String,
  22. observer: 'observeClass'
  23. },
  24. zIndex: {
  25. type: Number,
  26. value: 100
  27. },
  28. overlay: {
  29. type: Boolean,
  30. value: true
  31. },
  32. closeIcon: {
  33. type: String,
  34. value: 'cross'
  35. },
  36. closeIconPosition: {
  37. type: String,
  38. value: 'top-right'
  39. },
  40. closeOnClickOverlay: {
  41. type: Boolean,
  42. value: true
  43. },
  44. position: {
  45. type: String,
  46. value: 'center',
  47. observer: 'observeClass'
  48. },
  49. safeAreaInsetBottom: {
  50. type: Boolean,
  51. value: true
  52. },
  53. safeAreaInsetTop: {
  54. type: Boolean,
  55. value: false
  56. }
  57. },
  58. created: function () {
  59. this.observeClass();
  60. },
  61. methods: {
  62. onClickCloseIcon: function () {
  63. this.$emit('close');
  64. },
  65. onClickOverlay: function () {
  66. this.$emit('click-overlay');
  67. if (this.data.closeOnClickOverlay) {
  68. this.$emit('close');
  69. }
  70. },
  71. observeClass: function () {
  72. var _a = this.data, transition = _a.transition, position = _a.position;
  73. var updateData = {
  74. name: transition || position
  75. };
  76. if (transition === 'none') {
  77. updateData.duration = 0;
  78. }
  79. this.setData(updateData);
  80. }
  81. }
  82. });