1234567891011121314151617181920212223242526272829303132
  1. import { VantComponent } from '../common/component';
  2. VantComponent({
  3. field: true,
  4. relation: {
  5. name: 'radio-group',
  6. type: 'ancestor'
  7. },
  8. classes: ['icon-class', 'label-class'],
  9. props: {
  10. name: null,
  11. value: null,
  12. disabled: Boolean,
  13. labelDisabled: Boolean,
  14. labelPosition: String,
  15. checkedColor: String
  16. },
  17. methods: {
  18. emitChange(value) {
  19. const instance = this.getRelationNodes('../radio-group/index')[0] || this;
  20. instance.$emit('input', value);
  21. instance.$emit('change', value);
  22. },
  23. onChange(event) {
  24. this.emitChange(event.detail.value);
  25. },
  26. onClickLabel() {
  27. if (!this.data.disabled && !this.data.labelDisabled) {
  28. this.emitChange(this.data.name);
  29. }
  30. }
  31. }
  32. });