index.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 ((0, version_1.canIUseFormFieldButton)()) {
  8. mixins.push('wx://form-field-button');
  9. }
  10. (0, 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. });