index.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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',
  8. type: 'descendant',
  9. current: 'radio-group',
  10. linked: function (target) {
  11. this.updateChild(target);
  12. },
  13. },
  14. props: {
  15. value: {
  16. type: null,
  17. observer: 'updateChildren'
  18. },
  19. disabled: {
  20. type: Boolean,
  21. observer: 'updateChildren'
  22. }
  23. },
  24. methods: {
  25. updateChildren: function () {
  26. var _this = this;
  27. (this.children || []).forEach(function (child) {
  28. return _this.updateChild(child);
  29. });
  30. },
  31. updateChild: function (child) {
  32. var _a = this.data, value = _a.value, disabled = _a.disabled;
  33. child.setData({
  34. value: value,
  35. disabled: disabled || child.data.disabled
  36. });
  37. }
  38. }
  39. });