index.js 1.9 KB

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