海鲜小程序

index.js 1003B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import { VantComponent } from '../common/component';
  2. VantComponent({
  3. field: true,
  4. relation: {
  5. name: 'radio-group',
  6. type: 'ancestor',
  7. current: 'radio',
  8. },
  9. classes: ['icon-class', 'label-class'],
  10. props: {
  11. name: null,
  12. value: null,
  13. disabled: Boolean,
  14. useIconSlot: Boolean,
  15. checkedColor: String,
  16. labelPosition: {
  17. type: String,
  18. value: 'right',
  19. },
  20. labelDisabled: Boolean,
  21. shape: {
  22. type: String,
  23. value: 'round',
  24. },
  25. iconSize: {
  26. type: null,
  27. value: 20,
  28. },
  29. },
  30. methods: {
  31. emitChange(value) {
  32. const instance = this.parent || this;
  33. instance.$emit('input', value);
  34. instance.$emit('change', value);
  35. },
  36. onChange() {
  37. if (!this.data.disabled) {
  38. this.emitChange(this.data.name);
  39. }
  40. },
  41. onClickLabel() {
  42. const { disabled, labelDisabled, name } = this.data;
  43. if (!disabled && !labelDisabled) {
  44. this.emitChange(name);
  45. }
  46. },
  47. },
  48. });