index.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var component_1 = require('../common/component');
  4. var relation_1 = require('../common/relation');
  5. component_1.VantComponent({
  6. field: true,
  7. relation: relation_1.useParent('radio-group'),
  8. classes: ['icon-class', 'label-class'],
  9. props: {
  10. name: null,
  11. value: null,
  12. disabled: Boolean,
  13. useIconSlot: Boolean,
  14. checkedColor: String,
  15. labelPosition: {
  16. type: String,
  17. value: 'right',
  18. },
  19. labelDisabled: Boolean,
  20. shape: {
  21. type: String,
  22. value: 'round',
  23. },
  24. iconSize: {
  25. type: null,
  26. value: 20,
  27. },
  28. },
  29. methods: {
  30. emitChange: function (value) {
  31. var instance = this.parent || this;
  32. instance.$emit('input', value);
  33. instance.$emit('change', value);
  34. },
  35. onChange: function () {
  36. if (!this.data.disabled) {
  37. this.emitChange(this.data.name);
  38. }
  39. },
  40. onClickLabel: function () {
  41. var _a = this.data,
  42. disabled = _a.disabled,
  43. labelDisabled = _a.labelDisabled,
  44. name = _a.name;
  45. if (!disabled && !labelDisabled) {
  46. this.emitChange(name);
  47. }
  48. },
  49. },
  50. });