index.js 870 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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 _createNamespace = (0, _utils.createNamespace)('radio'),
  7. createComponent = _createNamespace[0],
  8. bem = _createNamespace[1];
  9. var _default = createComponent({
  10. mixins: [(0, _checkbox.CheckboxMixin)({
  11. bem: bem,
  12. role: 'radio',
  13. parent: 'vanRadio'
  14. })],
  15. computed: {
  16. currentValue: {
  17. get: function get() {
  18. return this.parent ? this.parent.value : this.value;
  19. },
  20. set: function set(val) {
  21. (this.parent || this).$emit('input', val);
  22. }
  23. },
  24. checked: function checked() {
  25. return this.currentValue === this.name;
  26. }
  27. },
  28. methods: {
  29. toggle: function toggle() {
  30. this.currentValue = this.name;
  31. }
  32. }
  33. });
  34. exports.default = _default;