index.js 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. component_1.VantComponent({
  6. mixins: [button_1.button],
  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 (event) {
  43. var _this = this;
  44. var index = event.currentTarget.dataset.index;
  45. var _a = this.data, actions = _a.actions, closeOnClickAction = _a.closeOnClickAction, canIUseGetUserProfile = _a.canIUseGetUserProfile;
  46. var item = actions[index];
  47. if (item) {
  48. this.$emit('select', item);
  49. if (closeOnClickAction) {
  50. this.onClose();
  51. }
  52. if (item.openType === 'getUserInfo' && canIUseGetUserProfile) {
  53. wx.getUserProfile({
  54. desc: item.getUserProfileDesc || ' ',
  55. complete: function (userProfile) {
  56. _this.$emit('getuserinfo', userProfile);
  57. },
  58. });
  59. }
  60. }
  61. },
  62. onCancel: function () {
  63. this.$emit('cancel');
  64. },
  65. onClose: function () {
  66. this.$emit('close');
  67. },
  68. onClickOverlay: function () {
  69. this.$emit('click-overlay');
  70. this.onClose();
  71. },
  72. },
  73. });