index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var component_1 = require('../common/component');
  4. component_1.VantComponent({
  5. field: true,
  6. relation: {
  7. name: 'radio-group',
  8. type: 'ancestor',
  9. linked: function(target) {
  10. this.parent = target;
  11. },
  12. unlinked: function() {
  13. this.parent = null;
  14. }
  15. },
  16. classes: ['icon-class', 'label-class'],
  17. props: {
  18. value: null,
  19. disabled: Boolean,
  20. useIconSlot: Boolean,
  21. checkedColor: String,
  22. labelPosition: String,
  23. labelDisabled: Boolean,
  24. shape: {
  25. type: String,
  26. value: 'round'
  27. }
  28. },
  29. methods: {
  30. emitChange: function(value) {
  31. var instance = this.parent || this;
  32. instance.$emit('input', value);
  33. instance.$emit('change', value);
  34. },
  35. onChange: function(event) {
  36. this.emitChange(this.data.name);
  37. },
  38. onClickLabel: function() {
  39. var _a = this.data, disabled = _a.disabled, labelDisabled = _a.labelDisabled, name = _a.name;
  40. if (!disabled && !labelDisabled) {
  41. this.emitChange(name);
  42. }
  43. }
  44. }
  45. });