index.js 2.2 KB

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