index.js 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 version_1 = require("../common/version");
  6. var mixins = [button_1.button];
  7. if (version_1.canIUseFormFieldButton()) {
  8. mixins.push('wx://form-field-button');
  9. }
  10. component_1.VantComponent({
  11. mixins: mixins,
  12. classes: ['hover-class', 'loading-class'],
  13. data: {
  14. baseStyle: '',
  15. },
  16. props: {
  17. formType: String,
  18. icon: String,
  19. classPrefix: {
  20. type: String,
  21. value: 'van-icon',
  22. },
  23. plain: Boolean,
  24. block: Boolean,
  25. round: Boolean,
  26. square: Boolean,
  27. loading: Boolean,
  28. hairline: Boolean,
  29. disabled: Boolean,
  30. loadingText: String,
  31. customStyle: String,
  32. loadingType: {
  33. type: String,
  34. value: 'circular',
  35. },
  36. type: {
  37. type: String,
  38. value: 'default',
  39. },
  40. dataset: null,
  41. size: {
  42. type: String,
  43. value: 'normal',
  44. },
  45. loadingSize: {
  46. type: String,
  47. value: '20px',
  48. },
  49. color: String,
  50. },
  51. methods: {
  52. onClick: function (event) {
  53. var _this = this;
  54. this.$emit('click', event);
  55. var _a = this.data, canIUseGetUserProfile = _a.canIUseGetUserProfile, openType = _a.openType, getUserProfileDesc = _a.getUserProfileDesc, lang = _a.lang;
  56. if (openType === 'getUserInfo' && canIUseGetUserProfile) {
  57. wx.getUserProfile({
  58. desc: getUserProfileDesc || ' ',
  59. lang: lang || 'en',
  60. complete: function (userProfile) {
  61. _this.$emit('getuserinfo', userProfile);
  62. },
  63. });
  64. }
  65. },
  66. },
  67. });