index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { VantComponent } from '../common/component';
  2. import { button } from '../mixins/button';
  3. import { openType } from '../mixins/open-type';
  4. import { canIUseFormFieldButton } from '../common/version';
  5. const mixins = [button, openType];
  6. if (canIUseFormFieldButton()) {
  7. mixins.push('wx://form-field-button');
  8. }
  9. VantComponent({
  10. mixins,
  11. classes: ['hover-class', 'loading-class'],
  12. data: {
  13. baseStyle: '',
  14. },
  15. props: {
  16. formType: String,
  17. icon: String,
  18. classPrefix: {
  19. type: String,
  20. value: 'van-icon',
  21. },
  22. plain: Boolean,
  23. block: Boolean,
  24. round: Boolean,
  25. square: Boolean,
  26. loading: Boolean,
  27. hairline: Boolean,
  28. disabled: Boolean,
  29. loadingText: String,
  30. customStyle: String,
  31. loadingType: {
  32. type: String,
  33. value: 'circular',
  34. },
  35. type: {
  36. type: String,
  37. value: 'default',
  38. },
  39. dataset: null,
  40. size: {
  41. type: String,
  42. value: 'normal',
  43. },
  44. loadingSize: {
  45. type: String,
  46. value: '20px',
  47. },
  48. color: String,
  49. },
  50. methods: {
  51. onClick() {
  52. if (!this.data.loading) {
  53. this.$emit('click');
  54. }
  55. },
  56. noop() {},
  57. },
  58. });