index.js 903B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { VantComponent } from '../common/component';
  2. VantComponent({
  3. field: true,
  4. props: {
  5. value: null,
  6. icon: String,
  7. title: String,
  8. label: String,
  9. border: Boolean,
  10. checked: Boolean,
  11. loading: Boolean,
  12. disabled: Boolean,
  13. activeColor: String,
  14. inactiveColor: String,
  15. useLabelSlot: Boolean,
  16. size: {
  17. type: String,
  18. value: '24px'
  19. },
  20. activeValue: {
  21. type: null,
  22. value: true
  23. },
  24. inactiveValue: {
  25. type: null,
  26. value: false
  27. }
  28. },
  29. watch: {
  30. checked(value) {
  31. this.set({ value });
  32. }
  33. },
  34. created() {
  35. this.set({ value: this.data.checked });
  36. },
  37. methods: {
  38. onChange(event) {
  39. this.$emit('change', event.detail);
  40. }
  41. }
  42. });