index.js 988 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. direction: String,
  16. disabled: {
  17. type: Boolean,
  18. observer: 'updateChildren',
  19. },
  20. },
  21. methods: {
  22. updateChildren: function () {
  23. var _this = this;
  24. this.children.forEach(function (child) {
  25. return _this.updateChild(child);
  26. });
  27. },
  28. updateChild: function (child) {
  29. var _a = this.data,
  30. value = _a.value,
  31. disabled = _a.disabled,
  32. direction = _a.direction;
  33. child.setData({
  34. value: value,
  35. direction: direction,
  36. disabled: disabled || child.data.disabled,
  37. });
  38. },
  39. },
  40. });