index.js 1.7 KB

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