index.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. linked: function (target) {
  10. this.parent = target;
  11. },
  12. unlinked: function () {
  13. this.parent = null;
  14. }
  15. },
  16. classes: ['icon-class', 'label-class'],
  17. props: {
  18. value: null,
  19. disabled: Boolean,
  20. useIconSlot: Boolean,
  21. checkedColor: String,
  22. labelPosition: {
  23. type: String,
  24. value: 'right'
  25. },
  26. labelDisabled: Boolean,
  27. shape: {
  28. type: String,
  29. value: 'round'
  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 (event) {
  39. console.log(event);
  40. this.emitChange(this.data.name);
  41. },
  42. onClickLabel: function () {
  43. var _a = this.data, disabled = _a.disabled, labelDisabled = _a.labelDisabled, name = _a.name;
  44. if (!disabled && !labelDisabled) {
  45. this.emitChange(name);
  46. }
  47. }
  48. }
  49. });