index.js 1.4 KB

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