index.js 1.3 KB

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