index.js 966 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = void 0;
  4. var _utils = require("../utils");
  5. var _checkbox = require("../mixins/checkbox");
  6. var _use = (0, _utils.use)('radio'),
  7. sfc = _use[0],
  8. bem = _use[1];
  9. var _default = sfc({
  10. mixins: [(0, _checkbox.CheckboxMixin)('van-radio-group', bem)],
  11. computed: {
  12. currentValue: {
  13. get: function get() {
  14. return this.parent ? this.parent.value : this.value;
  15. },
  16. set: function set(val) {
  17. (this.parent || this).$emit('input', val);
  18. }
  19. },
  20. checked: function checked() {
  21. return this.currentValue === this.name;
  22. }
  23. },
  24. methods: {
  25. onClickIcon: function onClickIcon() {
  26. if (!this.isDisabled) {
  27. this.currentValue = this.name;
  28. }
  29. },
  30. onClickLabel: function onClickLabel() {
  31. if (!this.isDisabled && !this.labelDisabled) {
  32. this.currentValue = this.name;
  33. }
  34. }
  35. }
  36. });
  37. exports["default"] = _default;