index.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. "use strict";
  2. var _component = require("../common/component");
  3. var _button = require("../mixins/button");
  4. var _openType = require("../mixins/open-type");
  5. (0, _component.VantComponent)({
  6. mixins: [_button.button, _openType.openType],
  7. props: {
  8. show: Boolean,
  9. title: String,
  10. cancelText: String,
  11. description: String,
  12. round: {
  13. type: Boolean,
  14. value: true
  15. },
  16. zIndex: {
  17. type: Number,
  18. value: 100
  19. },
  20. actions: {
  21. type: Array,
  22. value: []
  23. },
  24. overlay: {
  25. type: Boolean,
  26. value: true
  27. },
  28. closeOnClickOverlay: {
  29. type: Boolean,
  30. value: true
  31. },
  32. closeOnClickAction: {
  33. type: Boolean,
  34. value: true
  35. },
  36. safeAreaInsetBottom: {
  37. type: Boolean,
  38. value: true
  39. }
  40. },
  41. methods: {
  42. onSelect: function onSelect(event) {
  43. var index = event.currentTarget.dataset.index;
  44. var item = this.data.actions[index];
  45. if (item && !item.disabled && !item.loading) {
  46. this.$emit("select", item);
  47. if (this.data.closeOnClickAction) {
  48. this.onClose();
  49. }
  50. }
  51. },
  52. onCancel: function onCancel() {
  53. this.$emit("cancel");
  54. },
  55. onClose: function onClose() {
  56. this.$emit("close");
  57. },
  58. onClickOverlay: function onClickOverlay() {
  59. this.$emit("click-overlay");
  60. this.onClose();
  61. }
  62. }
  63. });