index.js 922 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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,
  33. value = _a.value,
  34. disabled = _a.disabled;
  35. child.setData({
  36. value: value,
  37. disabled: disabled || child.data.disabled,
  38. });
  39. },
  40. },
  41. });