index.js 2.1 KB

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