index.js 916 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. var _component = require("../common/component");
  3. (0, _component.VantComponent)({
  4. field: true,
  5. relation: {
  6. name: "radio",
  7. type: "descendant",
  8. current: "radio-group",
  9. linked: function linked(target) {
  10. this.updateChild(target);
  11. }
  12. },
  13. props: {
  14. value: {
  15. type: null,
  16. observer: "updateChildren"
  17. },
  18. disabled: {
  19. type: Boolean,
  20. observer: "updateChildren"
  21. }
  22. },
  23. methods: {
  24. updateChildren: function updateChildren() {
  25. var _this = this;
  26. (this.children || []).forEach(function (child) {
  27. return _this.updateChild(child);
  28. });
  29. },
  30. updateChild: function updateChild(child) {
  31. var _this$data = this.data,
  32. value = _this$data.value,
  33. disabled = _this$data.disabled;
  34. child.setData({
  35. value: value,
  36. disabled: disabled || child.data.disabled
  37. });
  38. }
  39. }
  40. });