index.js 909 B

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