index.js 1.2 KB

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